<template>
  <div id="recruitTable">
    <el-dialog title="退回原因" :visible.sync="backFormVisible" :close-on-click-modal="false" width="700px" :close-on-press-escape="false">
      <el-form :model="backForm" ref="backForm" :inline="true" inline-message>
        <el-form-item prop="remark">
          <el-input v-model="backForm.remark" style="width:600px"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click.native="setState(5)" :loading="btnLoading">提交</el-button>
        <el-button @click.native="backFormVisible = false">取消</el-button>
      </div>
    </el-dialog>
    <div v-if="state===5" style="margin-bottom:10px;font-weight:bolder">状态：已退回  退回原因：{{remarks?remarks:'无'}}</div>
    <!-- 确认拟聘人选 -->
    <template v-if="step==='bus_candidate_registration'">
      <h1 style="text-align:center">{{theYear?theYear:2023}}年度招聘岗位</h1>
      <el-table :data="postList" highlight-current-row v-loading="listLoading4" style="width: 100%;margin-bottom: 20px;" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="50" :selectable="canSelect" v-if="userType===1">
        </el-table-column>
        <el-table-column type="index" label="序号" width="50" align="center">
        </el-table-column>
        <el-table-column prop="theType" label="岗位类型" width="150" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.theType===1">应届毕业生招聘</span>
            <span v-else>在职人员招聘</span>
          </template>
        </el-table-column>
        <el-table-column prop="unitName" label="单位名称" min-width="150" header-align="center">
          <template slot-scope="scope">
            {{scope.row.unitName}}（{{scope.row.unitBeijing===1?"在京单位":"京外单位"}}）
          </template>
        </el-table-column>
        <el-table-column prop="inBeijing" label="生源类型" width="100" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.inBeijing===1">京内生源</span>
            <span v-if="scope.row.inBeijing===2">京外生源</span>
          </template>
        </el-table-column>
        <el-table-column prop="department" label="具体工作部门" width="200" header-align="center">
        </el-table-column>
        <el-table-column prop="post" label="岗位" width="120" header-align="center">
        </el-table-column>
        <el-table-column prop="major" label="专业" width="120" header-align="center">
        </el-table-column>
        <el-table-column prop="education" label="学历要求" width="110" align="center">
        </el-table-column>
        <!-- <el-table-column prop="regTimes" label="备案次数" width="80" align="center">
        </el-table-column> -->
        <el-table-column prop="realName" label="姓名" width="80" align="center">
        </el-table-column>
        <el-table-column prop="idCardNo" label="身份证号" width="200" align="center">
        </el-table-column>
        <el-table-column prop="personState" label="状态" width="80" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.personState===0">未提交</span>
            <span v-else-if="scope.row.personState===1||scope.row.personState===2" style="color:green;font-weight:bolder">已提交</span>
            <span v-else-if="scope.row.personState===5" style="color:red;font-weight:bolder">已退回</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="200" key="detail">
          <template slot-scope="scope">
            <!-- <el-button v-if="canEdit&&scope.row.personState!==0&&scope.row.personState!==5" @click="handleDetail(scope.row,scope.row.theType,1)" size="small" type="success">增加备案人选</el-button>
            <el-button v-if="scope.row.regTimes>0" @click="handleDetailList(scope.row.id)" size="small" type="primary">查看已备案人选</el-button> -->
            <el-button v-if="canEdit&&scope.row.personState!==0&&scope.row.personState!==5&&scope.row.regTimes===0" @click="handleDetail(scope.row,scope.row.theType,1)" size="small" type="success">录入人员信息</el-button>
            <el-button v-if="scope.row.regTimes>0" @click="handleDetailList(scope.row)" size="small" type="primary">查看人员信息</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-button icon="el-icon-download" type="primary" style="margin-bottom:20px" @click="exportPersonList()" v-if="canEdit&&step==='bus_candidate_registration'" :loading='btnLoading'>导出所选人员名单</el-button>

      <el-dialog :title="dialogTitle" :visible.sync="addFormVisible" width="98%" top="20px">
        <h1 style="text-align:center">{{theYear}}年拟聘毕业生基本信息表</h1>
        <el-form v-if="dialogEdit" :model="editForm" label-width="200px" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" :rules="editFormRules">
          <table cellspacing="0" cellpadding="0" class="mytable">
            <tr>
              <th style="width:120px; vertical-align: middle;">接收单位</th>
              <td style="vertical-align: middle;" :colspan="5">
                <el-form-item prop="unitName">
                  <el-input v-model="editForm.unitName" style="width:500px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">单位类型</th>
              <td style="vertical-align: middle;" :colspan="editForm.unitBeijing===1?0:3">
                <span v-if="editForm.unitBeijing===1">在京单位</span>
                <span v-if="editForm.unitBeijing===2">京外单位</span>
              </td>
              <th v-if="editForm.unitBeijing===1" style="width:120px; vertical-align: middle;">生源类型</th>
              <td v-if="editForm.unitBeijing===1" style="vertical-align: middle;">
                <span v-if="editForm.inBeijing===1">京内生源</span>
                <span v-if="editForm.inBeijing===2">京外生源</span>
              </td>
              <th style="width:120px; vertical-align: middle;">生源地</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="place">
                  <el-select v-model="editForm.place" style="width:150px">
                    <el-option v-for="(item,index) in provinceOptions" :key="'place_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                  <span v-if="isShow" style="color:red; font-size: 14px; font-weight:bolder; margin-left: 2px;">生源地和生源类型不一致</span>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">招聘方式</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="recruitmentMethod">
                  <el-select v-model="editForm.recruitmentMethod" style="width:150px">
                    <el-option v-for="(item,index) in recruitmentMethodList" :key="'recruitmentMethod_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">拟聘部门</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="department">
                  <el-input v-model="editForm.department" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">岗位</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="post">
                  <el-input v-model="editForm.post" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">姓名</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="realName">
                  <el-input v-model="editForm.realName" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">性别</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="sex">
                  <el-select v-model="editForm.sex" style="width:150px">
                    <el-option v-for="(item,index) in sexList" :key="'sex_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">民族</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="nation">
                  <el-select v-model="editForm.nation" style="width:150px">
                    <el-option v-for="(item,index) in nationList" :key="'nation_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">身份证号</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="idCardNo">
                  <el-input v-model="editForm.idCardNo" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">婚姻状况</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="maritalStatus">
                  <el-select v-model="editForm.maritalStatus" style="width:150px">
                    <el-option v-for="(item,index) in maritalStatusList" :key="'maritalStatus_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">毕业生手机号码</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="phone">
                  <el-input v-model="editForm.phone" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">学历</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="education">
                  <el-select v-model="editForm.education" style="width:150px">
                    <el-option v-for="(item,index) in educationList" :key="'education_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">学位</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="degree">
                  <el-select v-model="editForm.degree" style="width:150px">
                    <el-option v-for="(item,index) in degreeList" :key="'degree_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">籍贯</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="nativePlace">
                  <el-input v-model="editForm.nativePlace" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;" rowspan="3">毕业院校</th>
              <th style="width:120px; vertical-align: middle;">名称</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="school">
                  <el-input v-model="editForm.school" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:200px; vertical-align: middle;" rowspan="3">专业<br><span style="color:green;font-weight:normal !important">岗位要求专业：{{editForm.reqMajor}}</span><br><span v-if="!editForm.meetMajorRequest&&editForm.id" style="color:red;font-weight:bolder">专业与岗位要求不完全一致</span></th>
              <th style="width:120px; vertical-align: middle;">专业大类</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="majorClass1">
                  <el-input v-model="editForm.majorClass1" style="width:200px"></el-input>
                  <br>注意：专业大类/专业中类/专业名称中至少有一个在岗位要求要求专业列表中，格式为：专业名称(专业代码)，例如：电子与计算机工程(080909T)
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">所在地</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="schoolLocation">
                  <el-input v-model="editForm.schoolLocation" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">专业中类</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="majorClass2">
                  <el-input v-model="editForm.majorClass2" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">是否留学生</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="internationalStudent">
                  <el-select v-model="editForm.internationalStudent">
                    <el-option :value="1" label="是" />
                    <el-option :value="0" label="否" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">专业名称</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="major">
                  <el-input v-model="editForm.major" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:130px; vertical-align: middle;">备注</th>
              <td style="vertical-align: middle;" colspan="5">
                <el-form-item prop="remarks">
                  <el-input v-model="editForm.remarks" style="width:400px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">填表人</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputer">
                  <el-input v-model="editForm.inputer" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">手机</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputerPhone">
                  <el-input v-model="editForm.inputerPhone" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">填表日期</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputDate">
                  <el-date-picker
                    v-model="editForm.inputDate"
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </td>
            </tr>
          </table>
        </el-form>
        <div v-else>
          <!-- <template v-if="personList.length>1">
            <span style="margin:15px">请选择该岗位已备案人选</span>
            <el-select v-model="personId" style="width:350px" @change="setForm">
              <el-option v-for="(item,index) in personList" :key="'person_'+index" :value="item.id" :label="item.realName+'(备案时间:'+item.dataCreateDatetime+')'" />
            </el-select>
          </template> -->
          <table cellspacing="0" cellpadding="0" class="mytable" style="margin-top:10px">
            <tr>
              <th style="width:120px; vertical-align: middle;">接收单位</th>
              <td style="vertical-align: middle;" :colspan="5">
                {{editForm.unitName}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">单位类型</th>
              <td style="vertical-align: middle;" :colspan="editForm.unitBeijing===1?0:3">
                <span v-if="editForm.unitBeijing===1">在京单位</span>
                <span v-if="editForm.unitBeijing===2">京外单位</span>
              </td>
              <th v-if="editForm.unitBeijing===1" style="width:120px; vertical-align: middle;">生源类型</th>
              <td v-if="editForm.unitBeijing===1" style="vertical-align: middle;">
                <span v-if="editForm.inBeijing===1">京内生源</span>
                <span v-if="editForm.inBeijing===2">京外生源</span>
              </td>
              <th style="width:120px; vertical-align: middle;">生源地</th>
              <td style="vertical-align: middle;">
                {{ editForm.place }}
                <span v-if="isShow" style="color:red; font-size: 14px; font-weight:bolder; margin-left: 2px;">生源地和生源类型不一致</span>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">招聘方式</th>
              <td style="vertical-align: middle;">
                {{recruitmentMethodList.find(item=>item.value==editForm.recruitmentMethod)?recruitmentMethodList.find(item=>item.value==editForm.recruitmentMethod).label:''}}
              </td>
              <th style="width:120px; vertical-align: middle;">拟聘部门</th>
              <td style="vertical-align: middle;">
                {{editForm.department}}
              </td>
              <th style="width:120px; vertical-align: middle;">岗位</th>
              <td style="vertical-align: middle;">
                {{editForm.post}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">姓名</th>
              <td style="vertical-align: middle;">
                {{editForm.realName}}
              </td>
              <th style="width:120px; vertical-align: middle;">性别</th>
              <td style="vertical-align: middle;">
                {{sexList.find(item=>item.value==editForm.sex)?sexList.find(item=>item.value==editForm.sex).label:''}}
              </td>
              <th style="width:120px; vertical-align: middle;">民族</th>
              <td style="vertical-align: middle;">
                {{editForm.nation}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">身份证号</th>
              <td style="vertical-align: middle;">
                {{editForm.idCardNo}}
              </td>
              <th style="width:120px; vertical-align: middle;">婚姻状况</th>
              <td style="vertical-align: middle;">
                {{editForm.maritalStatus}}
              </td>
              <th style="width:120px; vertical-align: middle;">毕业生手机号码</th>
              <td style="vertical-align: middle;">
                {{editForm.phone}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">学历</th>
              <td style="vertical-align: middle;">
                {{editForm.education}}
              </td>
              <th style="width:120px; vertical-align: middle;">学位</th>
              <td style="vertical-align: middle;">
                {{editForm.degree}}
              </td>
              <th style="width:120px; vertical-align: middle;">籍贯</th>
              <td style="vertical-align: middle;">
                {{editForm.nativePlace}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;" rowspan="3">毕业院校</th>
              <th style="width:120px; vertical-align: middle;">名称</th>
              <td style="vertical-align: middle;">
                {{editForm.school}}
              </td>
              <th style="width:200px; vertical-align: middle;" rowspan="3">专业<br><span style="color:green;font-weight:normal !important">岗位要求专业：{{editForm.reqMajor}}</span><br><span v-if="!editForm.meetMajorRequest&&editForm.id" style="color:red;font-weight:bolder">专业与岗位要求不完全一致</span></th>
              <th style="width:120px; vertical-align: middle;">专业大类</th>
              <td style="vertical-align: middle;">
                {{editForm.majorClass1}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">所在地</th>
              <td style="vertical-align: middle;">
                {{editForm.schoolLocation}}
              </td>
              <th style="width:120px; vertical-align: middle;">专业中类</th>
              <td style="vertical-align: middle;">
                {{editForm.majorClass2}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">是否留学生</th>
              <td style="vertical-align: middle;">
                {{editForm.internationalStudent?'是':'否'}}
              </td>
              <th style="width:120px; vertical-align: middle;">专业名称</th>
              <td style="vertical-align: middle;">
                {{editForm.major}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">备注</th>
              <td style="vertical-align: middle;" colspan="5">
                {{editForm.remarks}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">填表人</th>
              <td style="vertical-align: middle;">
                {{editForm.inputer}}
              </td>
              <th style="width:120px; vertical-align: middle;">手机</th>
              <td style="vertical-align: middle;">
                {{editForm.inputerPhone}}
              </td>
              <th style="width:120px; vertical-align: middle;">填表日期</th>
              <td style="vertical-align: middle;">
                {{editForm.inputDate}}
              </td>
            </tr>
          </table>
          <div v-if="canEdit&&(editForm.state===0||editForm.state===5)">
            <el-button type="primary" @click.native="dialogEdit=true">修改</el-button>
            <!-- <el-button type="danger" @click.native="removePerson(editForm.id)" :loading="btnLoading">删除</el-button> -->
          </div>
        </div>
        <div slot="footer" class="dialog-footer" v-if="dialogEdit">
          <el-button type="primary" @click.native="editFormSubmit()" :loading="editLoading">保存</el-button>
          <el-button @click.native="addFormVisible = false">取消</el-button>
        </div>
      </el-dialog>
      <el-dialog :title="dialogTitle" :visible.sync="addFormVisible_2" width="98%" top="20px">
        <h1 style="text-align:center">{{theYear}}年聘用在职人员基本信息表</h1>
        <el-form v-if="dialogEdit" :model="editFormb" label-width="200px" ref="editFormb" :inline="true" style="padding:10px 0 0;clear:both" :rules="editFormbRules">
          <table cellspacing="0" cellpadding="0" class="mytable">
            <tr>
              <th style="width:120px; vertical-align: middle;">接收单位</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="unitName">
                  <el-input v-model="editFormb.unitName" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">用人部门</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="department">
                  <el-input v-model="editFormb.department" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">岗位</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="post">
                  <el-input v-model="editFormb.post" style="width:300px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">姓名</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="realName">
                  <el-input v-model="editFormb.realName" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">身份证号</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="idCardNo">
                  <el-input v-model="editFormb.idCardNo" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">性别</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="sex">
                  <el-select v-model="editFormb.sex" style="width:150px">
                    <el-option v-for="(item,index) in sexList" :key="'sex_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">联系方式</th>
              <td style="vertical-align: middle;" colspan="3">
                <el-form-item prop="phone">
                  <el-input v-model="editFormb.phone" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">招聘方式</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="recruitmentMethod">
                  <el-select v-model="editFormb.recruitmentMethod" style="width:150px">
                    <el-option v-for="(item,index) in recruitmentMethodList" :key="'recruitmentMethod_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">学历</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="education">
                  <el-select v-model="editFormb.education" style="width:150px">
                    <el-option v-for="(item,index) in educationList" :key="'education_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">学位</th>
              <td style="vertical-align: middle;" colspan="3">
                <el-form-item prop="degree">
                  <el-select v-model="editFormb.degree" style="width:150px">
                    <el-option v-for="(item,index) in degreeList" :key="'degree_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">毕业院校</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="school">
                  <el-input v-model="editFormb.school" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:200px; vertical-align: middle;">专业<br><span style="color:green;font-weight:normal !important">岗位要求专业：{{editFormb.reqMajor}}</span><br><span v-if="!editFormb.meetMajorRequest&&editFormb.id" style="color:red;font-weight:bolder">专业与岗位要求不完全一致</span></th>
              <td style="vertical-align: middle;" colspan="3">
                <el-form-item prop="major">
                  <el-input v-model="editFormb.major" style="width:300px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">原工作单位</th>
              <td style="vertical-align: middle;" colspan="5">
                <el-form-item prop="originalUnit">
                  <el-input v-model="editFormb.originalUnit" style="width:300px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:130px; vertical-align: middle;">备注</th>
              <td style="vertical-align: middle;" colspan="5">
                <el-form-item prop="remarks">
                  <el-input v-model="editFormb.remarks" style="width:400px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">填表人</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputer">
                  <el-input v-model="editFormb.inputer" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">手机</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputerPhone">
                  <el-input v-model="editFormb.inputerPhone" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">填表日期</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputDate">
                  <el-date-picker
                    v-model="editFormb.inputDate"
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </td>
            </tr>
          </table>
        </el-form>
        <div v-else>
          <!-- <template v-if="personList.length>1">
            <span style="margin:15px">请选择该岗位已备案人选</span>
            <el-select v-model="personId" style="width:350px" @change="setForm">
              <el-option v-for="(item,index) in personList" :key="'person_'+index" :value="item.id" :label="item.realName+'(备案时间:'+item.dataCreateDatetime+')'" />
            </el-select>
          </template> -->
          <table cellspacing="0" cellpadding="0" class="mytable" style="margin-top:10px">
            <tr>
              <th style="width:120px; vertical-align: middle;">接收单位</th>
              <td style="vertical-align: middle;">
                {{editFormb.unitName}}
              </td>
              <th style="width:120px; vertical-align: middle;">用人部门</th>
              <td style="vertical-align: middle;">
                {{editFormb.department}}
              </td>
              <th style="width:120px; vertical-align: middle;">岗位</th>
              <td style="vertical-align: middle;">
                {{editFormb.post}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">姓名</th>
              <td style="vertical-align: middle;">
                {{editFormb.realName}}
              </td>
              <th style="width:120px; vertical-align: middle;">身份证号</th>
              <td style="vertical-align: middle;">
                {{editFormb.idCardNo}}
              </td>
              <th style="width:120px; vertical-align: middle;">性别</th>
              <td style="vertical-align: middle;">
                {{sexList.find(item=>item.value==editFormb.sex)?sexList.find(item=>item.value==editFormb.sex).label:''}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">联系方式</th>
              <td style="vertical-align: middle;" colspan="3">
                {{editFormb.phone}}
              </td>
              <th style="width:120px; vertical-align: middle;">招聘方式</th>
              <td style="vertical-align: middle;">
                {{recruitmentMethodList.find(item=>item.value==editFormb.recruitmentMethod)?recruitmentMethodList.find(item=>item.value==editFormb.recruitmentMethod).label:''}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">学历</th>
              <td style="vertical-align: middle;">
                {{editFormb.education}}
              </td>
              <th style="width:120px; vertical-align: middle;">学位</th>
              <td style="vertical-align: middle;" colspan="3">
                {{editFormb.degree}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">毕业院校</th>
              <td style="vertical-align: middle;">
                {{editFormb.school}}
              </td>
              <th style="width:200px; vertical-align: middle;">专业<br><span style="color:green;font-weight:normal !important">岗位要求专业：{{editFormb.reqMajor}}</span><br><span v-if="!editFormb.meetMajorRequest&&editFormb.id" style="color:red;font-weight:bolder">专业与岗位要求不完全一致</span></th>
              <td style="vertical-align: middle;" colspan="3">
                {{editFormb.major}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">原工作单位</th>
              <td style="vertical-align: middle;" colspan="5">
                {{editFormb.originalUnit}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">备注</th>
              <td style="vertical-align: middle;" colspan="5">
                {{editFormb.remarks}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">填表人</th>
              <td style="vertical-align: middle;">
                {{editFormb.inputer}}
              </td>
              <th style="width:120px; vertical-align: middle;">手机</th>
              <td style="vertical-align: middle;">
                {{editFormb.inputerPhone}}
              </td>
              <th style="width:120px; vertical-align: middle;">填表日期</th>
              <td style="vertical-align: middle;">
                {{editFormb.inputDate}}
              </td>
            </tr>
          </table>
          <div v-if="canEdit&&(editFormb.state===0||editFormb.state===5)&&step==='bus_candidate_registration'">
            <el-button type="primary" @click.native="dialogEdit=true">修改</el-button>
            <!-- <el-button type="danger" @click.native="removePerson(editFormb.id)" :loading="btnLoading">删除</el-button> -->
          </div>
        </div>
        <div slot="footer" class="dialog-footer" v-if="dialogEdit">
          <el-button type="primary" @click.native="editFormSubmitB()" :loading="editLoading">保存</el-button>
          <el-button @click.native="addFormVisible_2 = false">取消</el-button>
        </div>
      </el-dialog>
    </template>
    <!-- 聘用人员备案 -->
    <template v-else-if="step==='bus_registration'">
      <el-button type="success" :loading="btnLoading" style="float:right;" @click="registrationFinash()" v-if="userType===1">一键完成</el-button>
      <h1 style="text-align:center">{{theYear?theYear:2023}}年度招聘岗位</h1>
      <el-table :data="postList" highlight-current-row v-loading="listLoading4" style="width: 100%;margin-bottom: 20px;" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="50" :selectable="canSelect4" v-if="userType===1">
        </el-table-column>
        <el-table-column type="index" label="序号" width="50" align="center">
        </el-table-column>
        <el-table-column prop="theType" label="岗位类型" width="150" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.theType===1">应届毕业生招聘</span>
            <span v-else>在职人员招聘</span>
          </template>
        </el-table-column>
        <el-table-column prop="unitName" label="单位名称" min-width="150" header-align="center">
          <template slot-scope="scope">
            {{scope.row.unitName}}（{{scope.row.unitBeijing===1?"在京单位":"京外单位"}}）
          </template>
        </el-table-column>
        <el-table-column prop="inBeijing" label="生源类型" width="100" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.inBeijing===1">京内生源</span>
            <span v-if="scope.row.inBeijing===2">京外生源</span>
          </template>
        </el-table-column>
        <el-table-column prop="department" label="具体工作部门" width="200" header-align="center">
        </el-table-column>
        <el-table-column prop="post" label="岗位" width="120" header-align="center">
        </el-table-column>
        <el-table-column prop="major" label="专业" width="120" header-align="center">
        </el-table-column>
        <el-table-column prop="education" label="学历要求" width="110" align="center">
        </el-table-column>
        <!-- <el-table-column prop="regTimes" label="备案次数" width="80" align="center">
        </el-table-column> -->
        <el-table-column prop="realName" label="姓名" width="80" align="center">
        </el-table-column>
        <el-table-column prop="idCardNo" label="身份证号" width="200" align="center">
        </el-table-column>
        <el-table-column prop="personState" label="确认拟聘人员" width="120" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.personState===0">未确认</span>
            <span v-else-if="scope.row.personState===1||scope.row.personState===2" style="color:green;font-weight:bolder">已确认</span>
            <span v-else-if="scope.row.personState===5" style="color:red;font-weight:bolder">已退回</span>
          </template>
        </el-table-column>
        <el-table-column prop="stepState" label="人员备案状态" width="120" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.stepState===0">未完成</span>
            <span v-else-if="scope.row.stepState===1" style="color:green;font-weight:bolder">已完成</span>
            <el-tooltip v-if="scope.row.stepState===5" class="item" effect="dark" :content="'退回时间：'+scope.row.batchBackTime+ ' 退回原因：'+scope.row.batchRemarks" placement="top" :open-delay="500">
              <span style="color:red;font-weight:bolder; cursor: pointer">
                已退回 <i class="el-icon-warning"></i>
              </span>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="260" key="detail">
          <template slot-scope="scope">
            <el-button v-if="scope.row.regTimes>0" @click="handleDetailList(scope.row)" size="small" type="primary">查看人员信息</el-button>
            <el-button v-if="canEdit&&(scope.row.personState===1||scope.row.personState===2)&&(scope.row.stepState===5||scope.row.stepState===0)" :loading="btnLoading" @click="setState(1,scope.row)" size="small" type="success">完成</el-button>
            <el-button v-if="canBack&&scope.row.stepState===1" icon="el-icon-s-release" type="danger" @click="showBack(scope.row.batchId)">退回</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-button icon="el-icon-download" type="primary" style="margin-bottom:20px" @click="exportPersonList()" v-if="canEdit&&step==='bus_registration'" :loading='btnLoading'>导出所选人员名单</el-button>

      <el-dialog :title="dialogTitle" :visible.sync="addFormVisible" width="98%" top="20px">
        <h1 style="text-align:center">{{theYear}}年拟聘毕业生基本信息表</h1>
        <el-form v-if="dialogEdit" :model="editForm" label-width="200px" ref="editForm" :inline="true" style="padding:10px 0 0;clear:both" :rules="editFormRules">
          <table cellspacing="0" cellpadding="0" class="mytable">
            <tr>
              <th style="width:120px; vertical-align: middle;">接收单位</th>
              <td style="vertical-align: middle;" :colspan="5">
                <el-form-item prop="unitName">
                  <el-input v-model="editForm.unitName" style="width:500px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">单位类型</th>
              <td style="vertical-align: middle;" :colspan="editForm.unitBeijing===1?2:5">
                <span v-if="editForm.unitBeijing===1">在京单位</span>
                <span v-if="editForm.unitBeijing===2">京外单位</span>
              </td>
              <th v-if="editForm.unitBeijing===1" style="width:120px; vertical-align: middle;">生源类型</th>
              <td v-if="editForm.unitBeijing===1" style="vertical-align: middle;" :colspan="2">
                <span v-if="editForm.inBeijing===1">京内生源</span>
                <span v-if="editForm.inBeijing===2">京外生源</span>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">招聘方式</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="recruitmentMethod">
                  <el-select v-model="editForm.recruitmentMethod" style="width:150px">
                    <el-option v-for="(item,index) in recruitmentMethodList" :key="'recruitmentMethod_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">拟聘部门</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="department">
                  <el-input v-model="editForm.department" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">岗位</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="post">
                  <el-input v-model="editForm.post" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">姓名</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="realName">
                  <el-input v-model="editForm.realName" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">性别</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="sex">
                  <el-select v-model="editForm.sex" style="width:150px">
                    <el-option v-for="(item,index) in sexList" :key="'sex_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">民族</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="nation">
                  <el-select v-model="editForm.nation" style="width:150px">
                    <el-option v-for="(item,index) in nationList" :key="'nation_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">身份证号</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="idCardNo">
                  <el-input v-model="editForm.idCardNo" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">婚姻状况</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="maritalStatus">
                  <el-select v-model="editForm.maritalStatus" style="width:150px">
                    <el-option v-for="(item,index) in maritalStatusList" :key="'maritalStatus_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">毕业生手机号码</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="phone">
                  <el-input v-model="editForm.phone" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">学历</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="education">
                  <el-select v-model="editForm.education" style="width:150px">
                    <el-option v-for="(item,index) in educationList" :key="'education_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">学位</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="degree">
                  <el-select v-model="editForm.degree" style="width:150px">
                    <el-option v-for="(item,index) in degreeList" :key="'degree_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">生源地</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="place">
                  <el-input v-model="editForm.place" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;" rowspan="3">毕业院校</th>
              <th style="width:120px; vertical-align: middle;">名称</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="school">
                  <el-input v-model="editForm.school" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:200px; vertical-align: middle;" rowspan="3">专业<br><span style="color:green;font-weight:normal !important">岗位要求专业：{{editForm.reqMajor}}</span><br><span v-if="!editForm.meetMajorRequest&&editForm.id" style="color:red;font-weight:bolder">专业与岗位要求不完全一致</span></th>
              <th style="width:120px; vertical-align: middle;">专业大类</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="majorClass1">
                  <el-input v-model="editForm.majorClass1" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">所在地</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="schoolLocation">
                  <el-input v-model="editForm.schoolLocation" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">专业中类</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="majorClass2">
                  <el-input v-model="editForm.majorClass2" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">是否留学生</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="internationalStudent">
                  <el-select v-model="editForm.internationalStudent">
                    <el-option :value="1" label="是" />
                    <el-option :value="0" label="否" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">专业名称</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="major">
                  <el-input v-model="editForm.major" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:130px; vertical-align: middle;">备注</th>
              <td style="vertical-align: middle;" colspan="5">
                <el-form-item prop="remarks">
                  <el-input v-model="editForm.remarks" style="width:400px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">填表人</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputer">
                  <el-input v-model="editForm.inputer" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">手机</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputerPhone">
                  <el-input v-model="editForm.inputerPhone" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">填表日期</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputDate">
                  <el-date-picker
                    v-model="editForm.inputDate"
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </td>
            </tr>
          </table>
        </el-form>
        <div v-else>
          <!-- <template v-if="personList.length>1">
            <span style="margin:15px">请选择该岗位已备案人选</span>
            <el-select v-model="personId" style="width:350px" @change="setForm">
              <el-option v-for="(item,index) in personList" :key="'person_'+index" :value="item.id" :label="item.realName+'(备案时间:'+item.dataCreateDatetime+')'" />
            </el-select>
          </template> -->
          <table cellspacing="0" cellpadding="0" class="mytable" style="margin-top:10px">
            <tr>
              <th style="width:120px; vertical-align: middle;">接收单位</th>
              <td style="vertical-align: middle;" :colspan="5">
                {{editForm.unitName}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">单位类型</th>
              <td style="vertical-align: middle;" :colspan="editForm.unitBeijing===1?0:3">
                <span v-if="editForm.unitBeijing===1">在京单位</span>
                <span v-if="editForm.unitBeijing===2">京外单位</span>
              </td>
              <th v-if="editForm.unitBeijing===1" style="width:120px; vertical-align: middle;">生源类型</th>
              <td v-if="editForm.unitBeijing===1" style="vertical-align: middle;">
                <span v-if="editForm.inBeijing===1">京内生源</span>
                <span v-if="editForm.inBeijing===2">京外生源</span>
              </td>
              <th style="width:120px; vertical-align: middle;">生源地</th>
              <td style="vertical-align: middle;">
                {{ editForm.place }}
                <span v-if="isShow" style="color:red; font-size: 14px; font-weight:bolder; margin-left: 2px;">生源地和生源类型不一致</span>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">招聘方式</th>
              <td style="vertical-align: middle;">
                {{recruitmentMethodList.find(item=>item.value==editForm.recruitmentMethod)?recruitmentMethodList.find(item=>item.value==editForm.recruitmentMethod).label:''}}
              </td>
              <th style="width:120px; vertical-align: middle;">拟聘部门</th>
              <td style="vertical-align: middle;">
                {{editForm.department}}
              </td>
              <th style="width:120px; vertical-align: middle;">岗位</th>
              <td style="vertical-align: middle;">
                {{editForm.post}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">姓名</th>
              <td style="vertical-align: middle;">
                {{editForm.realName}}
              </td>
              <th style="width:120px; vertical-align: middle;">性别</th>
              <td style="vertical-align: middle;">
                {{sexList.find(item=>item.value==editForm.sex)?sexList.find(item=>item.value==editForm.sex).label:''}}
              </td>
              <th style="width:120px; vertical-align: middle;">民族</th>
              <td style="vertical-align: middle;">
                {{editForm.nation}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">身份证号</th>
              <td style="vertical-align: middle;">
                {{editForm.idCardNo}}
              </td>
              <th style="width:120px; vertical-align: middle;">婚姻状况</th>
              <td style="vertical-align: middle;">
                {{editForm.maritalStatus}}
              </td>
              <th style="width:120px; vertical-align: middle;">毕业生手机号码</th>
              <td style="vertical-align: middle;">
                {{editForm.phone}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">学历</th>
              <td style="vertical-align: middle;">
                {{editForm.education}}
              </td>
              <th style="width:120px; vertical-align: middle;">学位</th>
              <td style="vertical-align: middle;">
                {{editForm.degree}}
              </td>
              <th style="width:120px; vertical-align: middle;">籍贯</th>
              <td style="vertical-align: middle;">
                {{editForm.nativePlace}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;" rowspan="3">毕业院校</th>
              <th style="width:120px; vertical-align: middle;">名称</th>
              <td style="vertical-align: middle;">
                {{editForm.school}}
              </td>
              <th style="width:200px; vertical-align: middle;" rowspan="3">专业<br><span style="color:green;font-weight:normal !important">岗位要求专业：{{editForm.reqMajor}}</span><br><span v-if="!editForm.meetMajorRequest&&editForm.id" style="color:red;font-weight:bolder">专业与岗位要求不完全一致</span></th>
              <th style="width:120px; vertical-align: middle;">专业大类</th>
              <td style="vertical-align: middle;">
                {{editForm.majorClass1}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">所在地</th>
              <td style="vertical-align: middle;">
                {{editForm.schoolLocation}}
              </td>
              <th style="width:120px; vertical-align: middle;">专业中类</th>
              <td style="vertical-align: middle;">
                {{editForm.majorClass2}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">是否留学生</th>
              <td style="vertical-align: middle;">
                {{editForm.internationalStudent?'是':'否'}}
              </td>
              <th style="width:120px; vertical-align: middle;">专业名称</th>
              <td style="vertical-align: middle;">
                {{editForm.major}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">备注</th>
              <td style="vertical-align: middle;" colspan="5">
                {{editForm.remarks}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">填表人</th>
              <td style="vertical-align: middle;">
                {{editForm.inputer}}
              </td>
              <th style="width:120px; vertical-align: middle;">手机</th>
              <td style="vertical-align: middle;">
                {{editForm.inputerPhone}}
              </td>
              <th style="width:120px; vertical-align: middle;">填表日期</th>
              <td style="vertical-align: middle;">
                {{editForm.inputDate}}
              </td>
            </tr>
          </table>
          <div v-if="canEdit&&(editForm.state===0||editForm.state===5)">
            <el-button type="primary" @click.native="dialogEdit=true">修改</el-button>
            <!-- <el-button type="danger" @click.native="removePerson(editForm.id)" :loading="btnLoading">删除</el-button> -->
          </div>
        </div>
        <div slot="footer" class="dialog-footer" v-if="dialogEdit">
          <el-button type="primary" @click.native="editFormSubmit()" :loading="editLoading">保存</el-button>
          <el-button @click.native="addFormVisible = false">取消</el-button>
        </div>
      </el-dialog>
      <el-dialog :title="dialogTitle" :visible.sync="addFormVisible_2" width="98%" top="20px">
        <h1 style="text-align:center">{{theYear}}年聘用在职人员基本信息表</h1>
        <el-form v-if="dialogEdit" :model="editFormb" label-width="200px" ref="editFormb" :inline="true" style="padding:10px 0 0;clear:both" :rules="editFormbRules">
          <table cellspacing="0" cellpadding="0" class="mytable">
            <tr>
              <th style="width:120px; vertical-align: middle;">接收单位</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="unitName">
                  <el-input v-model="editFormb.unitName" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">用人部门</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="department">
                  <el-input v-model="editFormb.department" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">岗位</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="post">
                  <el-input v-model="editFormb.post" style="width:300px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">姓名</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="realName">
                  <el-input v-model="editFormb.realName" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">身份证号</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="idCardNo">
                  <el-input v-model="editFormb.idCardNo" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">性别</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="sex">
                  <el-select v-model="editFormb.sex" style="width:150px">
                    <el-option v-for="(item,index) in sexList" :key="'sex_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">联系方式</th>
              <td style="vertical-align: middle;" colspan="3">
                <el-form-item prop="phone">
                  <el-input v-model="editFormb.phone" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">招聘方式</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="recruitmentMethod">
                  <el-select v-model="editFormb.recruitmentMethod" style="width:150px">
                    <el-option v-for="(item,index) in recruitmentMethodList" :key="'recruitmentMethod_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">学历</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="education">
                  <el-select v-model="editFormb.education" style="width:150px">
                    <el-option v-for="(item,index) in educationList" :key="'education_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">学位</th>
              <td style="vertical-align: middle;" colspan="3">
                <el-form-item prop="degree">
                  <el-select v-model="editFormb.degree" style="width:150px">
                    <el-option v-for="(item,index) in degreeList" :key="'degree_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">毕业院校</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="school">
                  <el-input v-model="editFormb.school" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:200px; vertical-align: middle;">专业<br><span style="color:green;font-weight:normal !important">岗位要求专业：{{editFormb.reqMajor}}</span><br><span v-if="!editFormb.meetMajorRequest&&editFormb.id" style="color:red;font-weight:bolder">专业与岗位要求不完全一致</span></th>
              <td style="vertical-align: middle;" colspan="3">
                <el-form-item prop="major">
                  <el-input v-model="editFormb.major" style="width:300px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">原工作单位</th>
              <td style="vertical-align: middle;" colspan="5">
                <el-form-item prop="originalUnit">
                  <el-input v-model="editFormb.originalUnit" style="width:300px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:130px; vertical-align: middle;">备注</th>
              <td style="vertical-align: middle;" colspan="5">
                <el-form-item prop="remarks">
                  <el-input v-model="editFormb.remarks" style="width:400px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">填表人</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputer">
                  <el-input v-model="editFormb.inputer" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">手机</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputerPhone">
                  <el-input v-model="editFormb.inputerPhone" style="width:300px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">填表日期</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputDate">
                  <el-date-picker
                    v-model="editFormb.inputDate"
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </td>
            </tr>
          </table>
        </el-form>
        <div v-else>
          <!-- <template v-if="personList.length>1">
            <span style="margin:15px">请选择该岗位已备案人选</span>
            <el-select v-model="personId" style="width:350px" @change="setForm">
              <el-option v-for="(item,index) in personList" :key="'person_'+index" :value="item.id" :label="item.realName+'(备案时间:'+item.dataCreateDatetime+')'" />
            </el-select>
          </template> -->
          <table cellspacing="0" cellpadding="0" class="mytable" style="margin-top:10px">
            <tr>
              <th style="width:120px; vertical-align: middle;">接收单位</th>
              <td style="vertical-align: middle;">
                {{editFormb.unitName}}
              </td>
              <th style="width:120px; vertical-align: middle;">用人部门</th>
              <td style="vertical-align: middle;">
                {{editFormb.department}}
              </td>
              <th style="width:120px; vertical-align: middle;">岗位</th>
              <td style="vertical-align: middle;">
                {{editFormb.post}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">姓名</th>
              <td style="vertical-align: middle;">
                {{editFormb.realName}}
              </td>
              <th style="width:120px; vertical-align: middle;">身份证号</th>
              <td style="vertical-align: middle;">
                {{editFormb.idCardNo}}
              </td>
              <th style="width:120px; vertical-align: middle;">性别</th>
              <td style="vertical-align: middle;">
                {{sexList.find(item=>item.value==editFormb.sex)?sexList.find(item=>item.value==editFormb.sex).label:''}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">联系方式</th>
              <td style="vertical-align: middle;" colspan="3">
                {{editFormb.phone}}
              </td>
              <th style="width:120px; vertical-align: middle;">招聘方式</th>
              <td style="vertical-align: middle;">
                {{recruitmentMethodList.find(item=>item.value==editFormb.recruitmentMethod)?recruitmentMethodList.find(item=>item.value==editFormb.recruitmentMethod).label:''}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">学历</th>
              <td style="vertical-align: middle;">
                {{editFormb.education}}
              </td>
              <th style="width:120px; vertical-align: middle;">学位</th>
              <td style="vertical-align: middle;" colspan="3">
                {{editFormb.degree}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">毕业院校</th>
              <td style="vertical-align: middle;">
                {{editFormb.school}}
              </td>
              <th style="width:200px; vertical-align: middle;">专业<br><span style="color:green;font-weight:normal !important">岗位要求专业：{{editFormb.reqMajor}}</span><br><span v-if="!editFormb.meetMajorRequest&&editFormb.id" style="color:red;font-weight:bolder">专业与岗位要求不完全一致</span></th>
              <td style="vertical-align: middle;" colspan="3">
                {{editFormb.major}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">原工作单位</th>
              <td style="vertical-align: middle;" colspan="5">
                {{editFormb.originalUnit}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">备注</th>
              <td style="vertical-align: middle;" colspan="5">
                {{editFormb.remarks}}
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">填表人</th>
              <td style="vertical-align: middle;">
                {{editFormb.inputer}}
              </td>
              <th style="width:120px; vertical-align: middle;">手机</th>
              <td style="vertical-align: middle;">
                {{editFormb.inputerPhone}}
              </td>
              <th style="width:120px; vertical-align: middle;">填表日期</th>
              <td style="vertical-align: middle;">
                {{editFormb.inputDate}}
              </td>
            </tr>
          </table>
          <div v-if="canEdit&&(editFormb.state===0||editFormb.state===5)">
            <el-button type="primary" @click.native="dialogEdit=true">修改</el-button>
            <!-- <el-button type="danger" @click.native="removePerson(editFormb.id)" :loading="btnLoading">删除</el-button> -->
          </div>
        </div>
        <div slot="footer" class="dialog-footer" v-if="dialogEdit">
          <el-button type="primary" @click.native="editFormSubmitB()" :loading="editLoading">保存</el-button>
          <el-button @click.native="addFormVisible_2 = false">取消</el-button>
        </div>
      </el-dialog>
    </template>
    <!-- 签订聘用合同 -->
    <template v-else-if="step==='bus_sign_contract'">
      <el-button type="success" :loading="btnLoading" style="float:right;" @click="contractFinash()" v-if="userType===1">一键完成</el-button>
      <h1 style="text-align:center">{{theYear?theYear:2023}}年度招聘岗位</h1>
      <el-table :data="postList" highlight-current-row v-loading="listLoading4" style="width: 100%;margin-bottom: 20px;" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="50" :selectable="canSelect2" v-if="userType===1">
        </el-table-column>
        <el-table-column type="index" label="序号" width="50" align="center">
        </el-table-column>
        <el-table-column prop="theType" label="岗位类型" width="150" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.theType===1">应届毕业生招聘</span>
            <span v-else>在职人员招聘</span>
          </template>
        </el-table-column>
        <el-table-column prop="unitName" label="单位名称" min-width="150" header-align="center">
          <template slot-scope="scope">
            {{scope.row.unitName}}（{{scope.row.unitBeijing===1?"在京单位":"京外单位"}}）
          </template>
        </el-table-column>
        <el-table-column prop="inBeijing" label="生源类型" width="100" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.inBeijing===1">京内生源</span>
            <span v-if="scope.row.inBeijing===2">京外生源</span>
          </template>
        </el-table-column>
        <el-table-column prop="department" label="具体工作部门" width="200" header-align="center">
        </el-table-column>
        <el-table-column prop="post" label="岗位" width="120" header-align="center">
        </el-table-column>
        <el-table-column prop="major" label="专业" width="120" header-align="center">
        </el-table-column>
        <el-table-column prop="education" label="学历要求" width="110" align="center">
        </el-table-column>
        <el-table-column prop="realName" label="姓名" width="80" align="center">
        </el-table-column>
        <el-table-column prop="idCardNo" label="身份证号" width="200" align="center">
        </el-table-column>
        <el-table-column prop="personState" label="确认拟聘人员" width="120" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.personState===0">未确认</span>
            <span v-else-if="scope.row.personState===1||scope.row.personState===2" style="color:green;font-weight:bolder">已确认</span>
            <span v-else-if="scope.row.personState===5" style="color:red;font-weight:bolder">已退回</span>
          </template>
        </el-table-column>
        <el-table-column prop="personState" label="签订聘用合同" width="120" align="center">
          <template slot-scope="scope">
            <template v-if="scope.row.personState===1">
              <el-tooltip v-if="scope.row.stepState===5" class="item" effect="dark" :content="'退回时间：'+scope.row.batchBackTime+ ' 退回原因：'+scope.row.batchRemarks" placement="top" :open-delay="500">
                <span style="color:red;font-weight:bolder; cursor: pointer">
                  已退回 <i class="el-icon-warning"></i>
                </span>
              </el-tooltip>
              <span v-else>未完成</span>
            </template>
            <span v-else-if="scope.row.personState===2" style="color:green;font-weight:bolder">已完成</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="150" key="detail">
          <template slot-scope="scope">
            <el-button v-if="canEdit&&scope.row.personState===1&&(scope.row.stepState===5||scope.row.stepState===0)" :loading="btnLoading" @click="setState(1,scope.row)" size="small" type="success">完成</el-button>
            <el-button v-if="canBack&&scope.row.stepState===1" icon="el-icon-s-release" type="danger" @click="showBack(scope.row.batchId)">退回</el-button>
          </template>
        </el-table-column>
      </el-table>
    </template>
    <!-- 落户备案 -->
    <template v-else-if="step==='bus_settlement_registration'">
      <div v-if="!fileListLoading">
      <template v-if="files1&&files1.length>0">
        <h1>落户备案参考材料</h1>
        <div v-for="(item,index) in files1" :key="index" style="line-height:40px">
          <a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> {{item.fileName}}.{{item.fileType}}</a>
          <!-- <template v-if="item.fileType==='pdf'"><i style="cursor: pointer;" class="el-icon-search" @click="showfile(item.id)" /></template> -->
        </div>
      </template>
    </div>
    <div v-else>加载中...</div>
      <h1 style="text-align:center">{{theYear?theYear:2023}}年度招聘岗位</h1>
      <el-table :data="postList" highlight-current-row v-loading="listLoading4" style="width: 100%;margin-bottom: 20px;" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="50" :selectable="canSelect3" v-if="userType===1">
        </el-table-column>
        <el-table-column type="index" label="序号" width="50" align="center">
        </el-table-column>
        <el-table-column prop="theType" label="岗位类型" width="150" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.theType===1">应届毕业生招聘</span>
            <span v-else>在职人员招聘</span>
          </template>
        </el-table-column>
        <el-table-column prop="unitName" label="单位名称" min-width="150" header-align="center">
          <template slot-scope="scope">
            {{scope.row.unitName}}（{{scope.row.unitBeijing===1?"在京单位":"京外单位"}}）
          </template>
        </el-table-column>
        <el-table-column prop="inBeijing" label="生源类型" width="100" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.inBeijing===1">京内生源</span>
            <span v-if="scope.row.inBeijing===2">京外生源</span>
          </template>
        </el-table-column>
        <el-table-column prop="department" label="具体工作部门" width="200" header-align="center">
        </el-table-column>
        <el-table-column prop="post" label="岗位" width="120" header-align="center">
        </el-table-column>
        <el-table-column prop="major" label="专业" width="120" header-align="center">
        </el-table-column>
        <el-table-column prop="education" label="学历要求" width="110" align="center">
        </el-table-column>
        <el-table-column prop="realName" label="姓名" width="80" align="center">
        </el-table-column>
        <el-table-column prop="idCardNo" label="身份证号" width="200" align="center">
        </el-table-column>
        <el-table-column prop="personState" label="确认拟聘人员" width="120" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.personState===0">未确认</span>
            <span v-else-if="scope.row.personState===1||scope.row.personState===2" style="color:green;font-weight:bolder">已确认</span>
            <span v-else-if="scope.row.personState===5" style="color:red;font-weight:bolder">已退回</span>
          </template>
        </el-table-column>
        <el-table-column prop="personState" label="签订聘用合同" width="120" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.personState===1">未完成</span>
            <span v-else-if="scope.row.personState===2" style="color:green;font-weight:bolder">已完成</span>
          </template>
        </el-table-column>
        <el-table-column prop="personState" label="落户备案状态" width="120" align="center">
          <template slot-scope="scope">
            <template v-if="scope.row.personState===2">
              <span v-if="scope.row.settleDownState===1">未提交</span>
              <span v-else-if="scope.row.settleDownState===2" style="color:green;font-weight:bolder">已备案</span>
              <span v-else-if="scope.row.settleDownState===3" style="color:red;font-weight:bolder">已退回</span>
            </template>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="120" key="detail">
          <template slot-scope="scope">
            <el-button v-if="scope.row.personState===2&&(userType===1||(userType===2&&scope.row.settleDownState===2))" @click="handleDetail2(scope.row)" size="small" type="primary">落户备案</el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-button icon="el-icon-download" type="primary" style="margin-bottom:20px" @click="exportSettlementRegistration()" v-if="step==='bus_settlement_registration'" :loading='btnLoading'>导出在京单位生源落户情况表</el-button>
      <el-dialog :title="dialogTitle" :visible.sync="addFormVisible2" width="98%" top="20px">
        <h1 style="text-align:center">{{theYear}}年拟落户毕业生详细信息表</h1>
        <el-form v-if="editForm2.state!==2" :model="editForm2" label-width="200px" ref="editForm2" :inline="true" style="padding:10px 0 0;clear:both" :rules="editFormRules2">
          <table cellspacing="0" cellpadding="0" class="mytable">
            <tr>
              <th style="width:120px; vertical-align: middle;">接收单位</th>
              <td style="vertical-align: middle;" :colspan="5">
                <el-form-item prop="unitName">
                  <el-input v-model="editForm2.unitName" style="width:500px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">姓名</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="realName">
                  <el-input v-model="editForm2.realName" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">性别</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="sex">
                  <el-select v-model="editForm2.sex" style="width:150px">
                    <el-option v-for="(item,index) in sexList" :key="'sex_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">民族</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="nation">
                  <el-select v-model="editForm2.nation" style="width:150px">
                    <el-option v-for="(item,index) in nationList" :key="'nation_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">婚姻状况</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="maritalStatus">
                  <el-select v-model="editForm2.maritalStatus" style="width:150px">
                    <el-option v-for="(item,index) in maritalStatusList" :key="'maritalStatus_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">身份证号</th>
              <td style="vertical-align: middle;" colspan="3">
                <el-form-item prop="idCardNo">
                  <el-input v-model="editForm2.idCardNo" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">学历</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="education">
                  <el-select v-model="editForm2.education" style="width:150px">
                    <el-option v-for="(item,index) in educationList" :key="'education_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">籍贯</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="nativePlace">
                  <el-input v-model="editForm2.nativePlace" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">生源地</th>
              <td style="vertical-align: middle;" colspan="2">
                <el-form-item prop="place">
                  <el-select v-model="editForm2.place" style="width:150px">
                    <el-option v-for="(item,index) in provinceOptions" :key="'place_'+index" :value="item.value" :label="item.label" />
                  </el-select>
                  <span v-if="isShow" style="color:red; font-size: 14px; font-weight:bolder; margin-left: 2px;">生源地和生源类型不一致</span>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;" rowspan="2">毕业院校</th>
              <th style="width:120px; vertical-align: middle;">名称</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="school">
                  <el-input v-model="editForm2.school" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">毕业证书编号</th>
              <td style="vertical-align: middle;" colspan="2">
                <el-form-item prop="graduationCertificateNumber">
                  <el-input v-model="editForm2.graduationCertificateNumber" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">所在省份</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="schoolLocation">
                  <el-input v-model="editForm2.schoolLocation" style="width:200px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">学位证书编号</th>
              <td style="vertical-align: middle;" colspan="2">
                <el-form-item prop="degreeCertificateNumber">
                  <el-input v-model="editForm2.degreeCertificateNumber" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;" colspan="2">户口迁出详细地址<br>（必须与户口迁移证或户口首页一致）</th>
              <td style="vertical-align: middle;" colspan="6">
                <el-form-item prop="relocationAddress">
                  <el-input v-model="editForm2.relocationAddress" style="width:500px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;" colspan="2">户口迁出登记机关<br>（必须与户口迁移证或户口首页一致）</th>
              <td style="vertical-align: middle;" colspan="4">
                <el-form-item prop="relocationOrgan">
                  <el-input v-model="editForm2.relocationOrgan" style="width:500px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;" colspan="2">户口迁入详细地址<br>（必须与接收单位集体户首页一致）</th>
              <td style="vertical-align: middle;" colspan="4">
                <el-form-item prop="movingInAddress">
                  <el-input v-model="editForm2.movingInAddress" style="width:500px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;" colspan="2">拟落户公安分局派出所<br>（必须与接收单位集体户首页一致）</th>
              <td style="vertical-align: middle;" colspan="4">
                <el-form-item prop="movingInOrgan">
                  <el-input v-model="editForm2.movingInOrgan" style="width:500px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;" colspan="2">落户区域</th>
              <td style="vertical-align: middle;" colspan="4">
                <el-form-item prop="settlementArea">
                  <el-select v-model="editForm2.settlementArea" style="width:150px">
                    <el-option v-for="(item,index) in areaList" :key="'area_'+index" :value="item" :label="item" />
                  </el-select>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;" colspan="2">毕业生手机号码</th>
              <td style="vertical-align: middle;" colspan="4">
                <el-form-item prop="phone">
                  <el-input v-model="editForm2.phone" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">填表人</th>
              <td style="vertical-align: middle;" colspan="3">
                <el-form-item prop="inputer">
                  <el-input v-model="editForm2.inputer" style="width:100px"></el-input>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">办公电话</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputerPhone">
                  <el-input v-model="editForm2.inputerPhone" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
            <tr>
              <th style="width:120px; vertical-align: middle;">填表日期</th>
              <td style="vertical-align: middle;" colspan="3">
                <el-form-item prop="inputDate">
                  <el-date-picker
                    v-model="editForm2.inputDate"
                    value-format="yyyy-MM-dd"
                    type="date"
                    placeholder="选择日期">
                  </el-date-picker>
                </el-form-item>
              </td>
              <th style="width:120px; vertical-align: middle;">手机</th>
              <td style="vertical-align: middle;">
                <el-form-item prop="inputerCellPhone">
                  <el-input v-model="editForm2.inputerCellPhone" style="width:200px"></el-input>
                </el-form-item>
              </td>
            </tr>
          </table>
          填表依据为：以户籍卡或户口迁移卡、学历证、学位证。
        </el-form>
        <table v-else cellspacing="0" cellpadding="0" class="mytable">
          <tr>
            <th style="width:120px; vertical-align: middle;">接收单位</th>
            <td style="vertical-align: middle;" :colspan="5">
              {{editForm2.unitName}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;">姓名</th>
            <td style="vertical-align: middle;">
              {{editForm2.realName}}
            </td>
            <th style="width:120px; vertical-align: middle;">性别</th>
            <td style="vertical-align: middle;">
              {{sexList.find(item=>item.value==editForm2.sex)?sexList.find(item=>item.value==editForm2.sex).label:''}}
            </td>
            <th style="width:120px; vertical-align: middle;">民族</th>
            <td style="vertical-align: middle;">
              {{editForm2.nation}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;">婚姻状况</th>
            <td style="vertical-align: middle;">
              {{editForm2.maritalStatus}}
            </td>
            <th style="width:120px; vertical-align: middle;">身份证号</th>
            <td style="vertical-align: middle;" colspan="3">
              {{editForm2.idCardNo}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;">学历</th>
            <td style="vertical-align: middle;">
              {{editForm2.education}}
            </td>
            <th style="width:120px; vertical-align: middle;">籍贯</th>
            <td style="vertical-align: middle;">
              {{editForm2.nativePlace}}
            </td>
            <th style="width:120px; vertical-align: middle;">生源地</th>
            <td style="vertical-align: middle;" colspan="2">
              {{editForm2.place}}
              <span v-if="isShow" style="color:red; font-size: 14px; font-weight:bolder; margin-left: 2px;">生源地和生源类型不一致</span>
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;" rowspan="2">毕业院校</th>
            <th style="width:120px; vertical-align: middle;">名称</th>
            <td style="vertical-align: middle;">
              {{editForm2.school}}
            </td>
            <th style="width:120px; vertical-align: middle;">毕业证书编号</th>
            <td style="vertical-align: middle;" colspan="2">
              {{editForm2.graduationCertificateNumber}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;">所在省份</th>
            <td style="vertical-align: middle;">
              {{editForm2.schoolLocation}}
            </td>
            <th style="width:120px; vertical-align: middle;">学位证书编号</th>
            <td style="vertical-align: middle;" colspan="2">
              {{editForm2.degreeCertificateNumber}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;" colspan="2">户口迁出详细地址<br>（必须与户口迁移证或户口首页一致）</th>
            <td style="vertical-align: middle;" colspan="6">
              {{editForm2.relocationAddress}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;" colspan="2">户口迁出登记机关<br>（必须与户口迁移证或户口首页一致）</th>
            <td style="vertical-align: middle;" colspan="4">
              {{editForm2.relocationOrgan}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;" colspan="2">户口迁入详细地址<br>（必须与接收单位集体户首页一致）</th>
            <td style="vertical-align: middle;" colspan="4">
              {{editForm2.movingInAddress}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;" colspan="2">拟落户公安分局派出所<br>（必须与接收单位集体户首页一致）</th>
            <td style="vertical-align: middle;" colspan="4">
              {{editForm2.movingInOrgan}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;" colspan="2">落户区域</th>
            <td style="vertical-align: middle;" colspan="4">
              {{editForm2.settlementArea}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;" colspan="2">毕业生手机号码</th>
            <td style="vertical-align: middle;" colspan="4">
              {{editForm2.phone}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;">填表人</th>
            <td style="vertical-align: middle;" colspan="3">
              {{editForm2.inputer}}
            </td>
            <th style="width:120px; vertical-align: middle;">办公电话</th>
            <td style="vertical-align: middle;">
              {{editForm2.inputerPhone}}
            </td>
          </tr>
          <tr>
            <th style="width:120px; vertical-align: middle;">填表日期</th>
            <td style="vertical-align: middle;" colspan="3">
              {{editForm2.inputDate}}
            </td>
            <th style="width:120px; vertical-align: middle;">手机</th>
            <td style="vertical-align: middle;">
              {{editForm2.inputerCellPhone}}
            </td>
          </tr>
        </table>
        <div slot="footer" class="dialog-footer" v-if="editForm2.state!==2">
          <el-button type="primary" @click.native="editFormSubmit2" :loading="editLoading">保存</el-button>
          <el-button @click.native="addFormVisible2 = false">取消</el-button>
        </div>
      </el-dialog>
    </template>
    <!-- 面试成绩上传 -->
    <template v-else>
      <h1 style="text-align:center">{{theYear}}年度招聘岗位</h1>
      <el-table :data="postList" highlight-current-row v-loading="listLoading4" style="width: 100%;margin-bottom: 20px;" @selection-change="handleSelectionChange">
        <el-table-column type="selection" width="55" v-if="userType===1">
        </el-table-column>
        <el-table-column type="index" label="序号" width="60" align="center">
        </el-table-column>
        <el-table-column prop="theType" label="岗位类型" width="150" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.theType===1">应届毕业生招聘</span>
            <span v-else>在职人员招聘</span>
          </template>
        </el-table-column>
        <el-table-column prop="unitName" label="单位名称" min-width="150" header-align="center">
          <template slot-scope="scope">
            {{scope.row.unitName}}（{{scope.row.unitBeijing===1?"在京单位":"京外单位"}}）
          </template>
        </el-table-column>
        <el-table-column prop="inBeijing" label="生源类型" width="100" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.inBeijing===1">京内生源</span>
            <span v-if="scope.row.inBeijing===2">京外生源</span>
          </template>
        </el-table-column>
        <el-table-column prop="department" label="具体工作部门" width="250" header-align="center">
        </el-table-column>
        <el-table-column prop="post" label="岗位" width="150" header-align="center">
        </el-table-column>
        <el-table-column prop="major" label="专业" width="250" header-align="center">
        </el-table-column>
        <el-table-column prop="education" label="学历要求" width="120" align="center">
        </el-table-column>
        <el-table-column prop="stepState" label="状态" width="80" align="center">
          <template slot-scope="scope">
            <span v-if="scope.row.stepState===0">未提交</span>
            <span v-else-if="scope.row.stepState===1" style="color:green;font-weight:bolder">已提交</span>
            <span v-else-if="scope.row.stepState===5" style="color:red;font-weight:bolder">已退回</span>
          </template>
        </el-table-column>
      </el-table>
    </template>
    <template v-if="step!=='bus_sign_contract'&&step!=='bus_registration'">
      <el-button icon="el-icon-s-promotion" type="success" style="margin-bottom:20px" @click="setState(0)" v-if="canEdit" :loading='btnLoading'>打捆</el-button>
    </template>
    <template v-if="step!=='bus_sign_contract'&&step!=='bus_registration'">
      <h1 style="text-align:center">批次列表</h1>
      <el-table :data="batchList" highlight-current-row v-loading="listLoading" style="width: 100%;margin-bottom: 20px;">
        <el-table-column prop="state" label="状态" width="150" align="center">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.state===0" effect="dark">未提交</el-tag>
            <el-tooltip v-if="scope.row.state===5" class="item" effect="dark" :content="'退回时间：'+scope.row.backTime+ ' 退回原因：'+scope.row.remarks" placement="top" :open-delay="500">
              <el-tag effect="dark" type="danger" style="cursor: pointer;">已退回</el-tag>
            </el-tooltip>
            <el-tooltip v-if="scope.row.state===1" class="item" effect="dark" :content="'提交时间：'+scope.row.submitTime" placement="top" :open-delay="500">
              <el-tag effect="dark" type="success" style="cursor: pointer;">已提交</el-tag>
            </el-tooltip>
          </template>
        </el-table-column>
        <el-table-column prop="num" label="岗位数量" width="150" align="center">
          <template slot-scope="scope">
            <el-popover placement="right" trigger="hover" :open-delay="500">
              <div class="recruitTable">
                <el-table :data="scope.row.postDocking" border>
                  <el-table-column prop="theType" label="岗位类型" width="150" align="center">
                    <template slot-scope="scope">
                      <span v-if="scope.row.theType===1">应届毕业生招聘</span>
                      <span v-else>在职人员招聘</span>
                    </template>
                  </el-table-column>
                  <el-table-column prop="unitName" label="单位名称" width="250" header-align="center">
                    <template slot-scope="scope">
                      {{scope.row.unitName}}（{{scope.row.unitBeijing===1?"在京单位":"京外单位"}}）
                    </template>
                  </el-table-column>
                  <el-table-column prop="inBeijing" label="生源类型" width="100" align="center">
                    <template slot-scope="scope">
                      <span v-if="scope.row.inBeijing===1">京内生源</span>
                      <span v-if="scope.row.inBeijing===2">京外生源</span>
                    </template>
                  </el-table-column>
                  <el-table-column prop="department" label="具体工作部门" width="250" header-align="center">
                  </el-table-column>
                  <el-table-column prop="post" label="岗位" width="150" header-align="center">
                  </el-table-column>
                  <el-table-column prop="major" label="专业" width="250" header-align="center">
                  </el-table-column>
                  <el-table-column prop="education" label="学历要求" width="150" align="center">
                  </el-table-column>
                </el-table>
              </div>
              <el-button slot="reference" type="text" icon="el-icon-search">{{scope.row.postDocking.length}}</el-button>
            </el-popover>
          </template>
        </el-table-column>
        <el-table-column prop="files" label="附件" min-width="150">
          <template slot-scope="scope">
            <div v-if="canEdit&&(scope.row.state===5||scope.row.state===0)">
              <el-upload
                style="width:800px;margin-bottom:10px;"
                ref="upload"
                :action="$http.defaults.baseURL+$http.defaults.recruitAPI +'api/recruitGenFileInfo/upload'"
                :on-success="function (res, file) { return handleUploadSucc1(res, file, scope.row.id)}"
                :on-error="uploadError"
                :before-upload="beforeUpload"
                :accept="(step === 'bus_interviewer_filing' || step === 'bus_interviewer_results')?'application/pdf':'application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-works,.wps'"
                :show-file-list="false"
              >
                <el-button type="primary" size="small" :loading="saveloading">上传</el-button>
                <!-- <div slot="tip" class="el-upload__tip">注：支持上传word/pdf/wps文件</div>
                <div style="clear:both" /> -->
              </el-upload>
            </div>
            <template v-if="scope.row.files&&scope.row.files.length>0">
              <div v-for="(item,index) in scope.row.files" :key="index" style="line-height:40px">
                <a href="javascript:void(0)" @click="download(item.id)"><i class="el-icon-paperclip" /> {{item.fileName}}.{{item.fileType}}</a>
                <el-button v-if="canEdit&&(scope.row.state===5||scope.row.state===0)" :loading="listLoading" style="margin-left:10px" size="mini" type="danger" @click="beforeRemove(item,step,'files')">删除</el-button>
              </div>
            </template>
          </template>
        </el-table-column>
        <el-table-column label="操作" width="300" key="detail">
          <template slot-scope="scope">
            <el-button v-if="canEdit&&(scope.row.state===5||scope.row.state===0)" :loading="btnLoading" @click="setState(1,scope.row.id)" size="small" type="success">提交</el-button>
            <el-button v-if="canEdit&&(scope.row.state===5||scope.row.state===0)" :loading="listLoading" @click="removeBatch(scope.row.id)" size="small" type="danger">删除</el-button>
            <el-button v-if="canBack&&scope.row.state===1" icon="el-icon-s-release" type="danger" @click="showBack(scope.row.id)">退回</el-button>
          </template>
        </el-table-column>
      </el-table>
    </template>
  </div>
</template>
<script>
export default {
  props: {
    step: '',
    timestamp: '',
    userType: null,
    unitId: null,
    type: null,
    theYear: null,
    unitBeijing: null,
    canAudit: null
  },
  watch: {
    step (val) {
      console.log(val)
    },
    userType (val) {
      console.log(val)
    },
    timestamp (val) {
      if (this.userType === 1) {
        // this.getFileList()
        this.canEdit = true
      } else {
        this.canEdit = false
      }
      if (this.userType === 2) {
        this.canBack = true
      } else {
        this.canBack = false
      }
      this.getPostListOtherStep()
      this.getStepBatch()
    },
    type (val) {
      console.log(val)
    },
    unitId (val) {
      console.log(val)
    },
    theYear (val) {
      console.log(val)
      if (this.step === 'bus_settlement_registration') {
        this.getFilesList()
      }
    },
    unitBeijing (val) {
      console.log(val)
    },
    batchState (val) {
      console.log(val)
    },
    canAudit (val) {
      console.log(val)
    },
    editForm: {
      handler (newVal) {
        if (newVal.unitBeijing === 2) {
          this.isShow = false
          return
        }
        if (newVal.inBeijing === 1) {
          newVal.place === '北京市' ? this.isShow = false : this.isShow = true
        } else if (newVal.inBeijing === 2) {
          newVal.place === '北京市' ? this.isShow = true : this.isShow = false
        } else {
          this.isShow = false
        }
      },
      deep: true
    },
    editForm2: {
      handler (newVal) {
        newVal.place === '北京市' ? this.isShow = true : this.isShow = false
      },
      deep: true
    }
  },
  data () {
    return {
      detailLoading: false,
      personId: null,
      personLoading: false,
      personList: [],
      remarks: null,
      listLoading1: false,
      listLoading2: false,
      listLoading3: false,
      listLoading4: false,
      state: null,
      canEdit: false,
      canBack: false,
      dialogEdit: 0,
      batchList: [
      ],
      batchPostList: [
      ],
      postList: [
      ],
      list1: [
      ],
      list2: [
      ],
      list3: [
      ],
      dialogTitle: '',
      // 专业类别未补全、民族未补全
      typeList: [{label: '应届毕业生招聘', value: 2}, {label: '在职人员招聘', value: 1}],
      sexList: [{label: '男', value: 1}, {label: '女', value: 0}],
      areaList: [
        '东城区',
        '西城区',
        '朝阳区',
        '海淀区',
        '丰台区',
        '石景山区',
        '门头沟区',
        '房山区',
        '大兴区',
        '通州区',
        '顺义区',
        '昌平区',
        '平谷区',
        '怀柔区',
        '密云县',
        '延庆县'
      ],
      nationList: [
        '汉族',
        '蒙古族',
        '回族',
        '藏族',
        '维吾尔族',
        '苗族',
        '彝族',
        '壮族',
        '布依族',
        '朝鲜族',
        '满族',
        '侗族',
        '瑶族',
        '白族',
        '土家族',
        '哈尼族',
        '哈萨克族',
        '傣族',
        '黎族',
        '傈僳族',
        '佤族',
        '畲族',
        '高山族',
        '拉祜族',
        '水族',
        '东乡族',
        '纳西族',
        '景颇族',
        '柯尔克孜族',
        '土族',
        '达斡尔族',
        '仫佬族',
        '羌族',
        '布朗族',
        '撒拉族',
        '毛南族',
        '仡佬族',
        '锡伯族',
        '阿昌族',
        '普米族',
        '塔吉克族',
        '怒族',
        '乌孜别克族',
        '俄罗斯族',
        '鄂温克族',
        '德昂族',
        '保安族',
        '裕固族',
        '京族',
        '塔塔尔族',
        '独龙族',
        '鄂伦春族',
        '赫哲族',
        '门巴族',
        '珞巴族',
        '基诺族'
      ],
      maritalStatusList: ['未婚', '已婚', '离婚', '丧偶'],
      degreeList: ['博士', '硕士', '学士', '其他'],
      educationList: ['大专', '本科生', '硕士研究生', '博士研究生', '其他'],
      recruitmentMethodList: [{label: '考试', value: 1}, {label: '引进', value: 2}],
      editLoading: false,
      backForm: {remark: ''},
      backFormVisible: false,
      fileListLoading: false,
      btnLoading: false,
      saveloading: false,
      files: [],
      listLoading: false,
      addFormVisible: false,
      addFormVisible_2: false,
      addFormVisible2: false,
      list: [],
      list_2: [],
      editFormRules: {
        unitName: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        theType: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        department: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        post: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        realName: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        idCardNo: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        sex: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        nation: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        maritalStatus: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        phone: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        school: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        schoolLocation: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        place: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        major: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        majorClass1: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        internationalStudent: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        education: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        degree: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        recruitmentMethod: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inputer: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inputerPhone: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inputDate: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        originalUnit: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inBeijing: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        nativePlace: [
          { required: true, message: '必填', trigger: 'blur' }
        ]
      },
      editFormbRules: {
        unitName: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        theType: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        department: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        post: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        realName: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        idCardNo: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        sex: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        nation: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        maritalStatus: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        phone: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        school: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        schoolLocation: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        place: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        major: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        majorClass1: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        internationalStudent: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        education: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        degree: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        recruitmentMethod: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inputer: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inputerPhone: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inputDate: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        originalUnit: [
          { required: true, message: '必填', trigger: 'blur' }
        ]
      },
      editForm: {
        id: null,
        unitName: '',
        theType: '',
        department: '',
        post: '',
        realName: '',
        idCardNo: '',
        sex: '',
        nation: '',
        maritalStatus: '',
        phone: '',
        school: '',
        schoolLocation: '',
        place: '',
        major: '',
        reqMajor: '',
        meetMajorRequest: '',
        majorClass1: '',
        majorClass2: '',
        internationalStudent: '',
        education: '',
        degree: '', // 表单缺
        recruitmentMethod: '', // 表单缺
        inputer: '',
        inputerPhone: '',
        inputDate: '',
        originalUnit: '',
        unitBeijing: null,
        remarks: '',
        theYear: null,
        inBeijing: null,
        inPost: null,
        isSettleDown: null,
        nativePlace: ''
      },
      editFormb: {
        id: null,
        unitName: '',
        theType: '',
        department: '',
        post: '',
        realName: '',
        idCardNo: '',
        sex: '',
        nation: '',
        maritalStatus: '',
        phone: '',
        school: '',
        schoolLocation: '',
        place: '',
        major: '',
        reqMajor: '',
        meetMajorRequest: '',
        majorClass1: '',
        majorClass2: '',
        internationalStudent: '',
        education: '',
        degree: '', // 表单缺
        recruitmentMethod: '', // 表单缺
        inputer: '',
        inputerPhone: '',
        inputDate: '',
        originalUnit: '',
        unitBeijing: null,
        remarks: '',
        theYear: null,
        inBeijing: null,
        inPost: null,
        isSettleDown: null
      },
      // 以下初始变量未更新
      editFormRules2: {
        unitName: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        realName: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        sex: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        nation: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        maritalStatus: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        idCardNo: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        education: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        place: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        school: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        graduationCertificateNumber: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        schoolLocation: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        degreeCertificateNumber: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        relocationAddress: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        relocationOrgan: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        movingInAddress: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        movingInOrgan: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        settlementArea: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        phone: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inputer: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inputerPhone: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inputerCellPhone: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        inputDate: [
          { required: true, message: '必填', trigger: 'blur' }
        ],
        nativePlace: [
          { required: true, message: '必填', trigger: 'blur' }
        ]
      },
      editForm2: {
        id: null,
        unitName: '',
        realName: '',
        sex: '',
        nation: '',
        maritalStatus: '',
        idCardNo: '',
        education: '',
        place: '',
        school: '',
        graduationCertificateNumber: '',
        schoolLocation: '',
        degreeCertificateNumber: '',
        relocationAddress: '',
        relocationOrgan: '',
        movingInAddress: '',
        movingInOrgan: '',
        settlementArea: '',
        phone: '',
        inputer: '',
        inputerPhone: '',
        inputerCellPhone: '',
        inputDate: '',
        nativePlace: ''
      },
      multipleSelection: [],
      stepBatchId: null,
      provinceOptions: [
        {label: '北京市', value: '北京市'},
        {label: '天津市', value: '天津市'},
        {label: '河北省', value: '河北省'},
        {label: '山西省', value: '山西省'},
        {label: '内蒙古自治区', value: '内蒙古自治区'},
        {label: '辽宁省', value: '辽宁省'},
        {label: '吉林省', value: '吉林省'},
        {label: '黑龙江省', value: '黑龙江省'},
        {label: '上海市', value: '上海市'},
        {label: '江苏省', value: '江苏省'},
        {label: '浙江省', value: '浙江省'},
        {label: '安徽省', value: '安徽省'},
        {label: '福建省', value: '福建省'},
        {label: '江西省', value: '江西省'},
        {label: '山东省', value: '山东省'},
        {label: '河南省', value: '河南省'},
        {label: '湖北省', value: '湖北省'},
        {label: '湖南省', value: '湖南省'},
        {label: '广东省', value: '广东省'},
        {label: '广西壮族自治区', value: '广西壮族自治区'},
        {label: '海南省', value: '海南省'},
        {label: '重庆市', value: '重庆市'},
        {label: '四川省', value: '四川省'},
        {label: '贵州省', value: '贵州省'},
        {label: '云南省', value: '云南省'},
        {label: '西藏自治区', value: '西藏自治区'},
        {label: '陕西省', value: '陕西省'},
        {label: '甘肃省', value: '甘肃省'},
        {label: '青海省', value: '青海省'},
        {label: '宁夏回族自治区', value: '宁夏回族自治区'},
        {label: '新疆维吾尔自治区', value: '新疆维吾尔自治区'},
        {label: '香港特别行政区', value: '香港特别行政区'},
        {label: '澳门特别行政区', value: '澳门特别行政区'},
        {label: '台湾省', value: '台湾省'}
      ],
      isShow: false,
      files1: []
    }
  },
  methods: {
    // 聘用人员备案 - 一键完成
    registrationFinash () {
      if (this.multipleSelection && this.multipleSelection.length > 0) {
        this.$confirm('确认要提交吗?', '提示', {
          type: 'warning'
        }).then(() => {
          this.btnLoading = true
          const para = {
            theYear: this.theYear,
            batchIds: [],
            postDockingIds: []
          }
          this.multipleSelection.forEach(item => {
            if (item.batchId) {
              para.batchIds.push(item.batchId)
            } else {
              para.postDockingIds.push(item.id)
            }
          })
          this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPostStepBatch/saveBatchRegistration`, para).then(response => {
            this.btnLoading = false
            if (response.data.success === true) {
              this.$message({
                message: '操作成功',
                type: 'success'
              })
              this.$emit('getDetails')
            } else {
              console.log('操作失败:' + response.data.message)
              this.$message({
                message: '操作失败:' + response.data.message,
                type: 'error'
              })
            }
          }).catch(error => {
            this.btnLoading = false
            console.log(error)
            this.$message({
              message: '操作失败:' + error,
              type: 'error'
            })
          })
        })
      } else {
        this.$message({
          message: '请至少选择一条记录',
          type: 'error'
        })
        return false
      }
    },
    // 签订聘用合同 - 一键完成
    contractFinash () {
      if (this.multipleSelection && this.multipleSelection.length > 0) {
        this.$confirm('确认要提交吗?', '提示', {
          type: 'warning'
        }).then(() => {
          this.btnLoading = true
          const para = {
            theYear: this.theYear,
            batchIds: [],
            candidateRegistrationIds: [],
            postDockingIds: []
          }
          this.multipleSelection.forEach(item => {
            if (item.batchId) {
              para.batchIds.push(item.batchId)
            } else {
              para.candidateRegistrationIds.push(item.personId)
              para.postDockingIds.push(item.id)
            }
          })
          this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPostStepBatch/saveBatchContract`, para).then(response => {
            this.btnLoading = false
            if (response.data.success === true) {
              this.$message({
                message: '操作成功',
                type: 'success'
              })
              this.$emit('getDetails')
            } else {
              console.log('操作失败:' + response.data.message)
              this.$message({
                message: '操作失败:' + response.data.message,
                type: 'error'
              })
            }
          }).catch(error => {
            this.btnLoading = false
            console.log(error)
            this.$message({
              message: '操作失败:' + error,
              type: 'error'
            })
          })
        })
      } else {
        this.$message({
          message: '请至少选择一条记录',
          type: 'error'
        })
        return false
      }
    },
    exportSettlementRegistration () {
      if (this.unitId) {
        window.open(this.$http.defaults.baseURL + this.$http.defaults.recruitAPI + 'api/recruitBusPost/getBeijingExport?theYear=' + this.theYear + '&unitId=' + this.unitId)
      } else {
        window.open(this.$http.defaults.baseURL + this.$http.defaults.recruitAPI + 'api/recruitBusPost/getBeijingExport?theYear=' + this.theYear)
      }
    },
    exportPersonList () {
      if (this.multipleSelection && this.multipleSelection.length > 0) {
        let personIds = this.multipleSelection.map(item => item.personId).join(',')
        window.open(this.$http.defaults.baseURL + this.$http.defaults.recruitAPI + 'api/recruitBusCandidateRegistration/getPersonsExport?personIds=' + personIds)
      } else {
        this.$message({
          message: '请至少选择一条记录',
          type: 'error'
        })
        return false
      }
    },
    removePerson (id) {
      this.$confirm('确认删除该记录吗?', '提示', {
        type: 'warning'
      }).then(() => {
        let para = {ids: [id]}
        this.btnLoading = true
        this.$http.post(this.$http.defaults.recruitAPI + 'api/recruitBusCandidateRegistration/remove', para).then(response => {
          this.btnLoading = false
          if (response.data.success === true) {
            this.$message({
              message: '删除成功',
              type: 'success'
            })
            this.getPostListOtherStep()
            this.addFormVisible = false
            this.addFormVisible_2 = false
          } else {
            console.log('删除失败:' + response.data.message)
            this.$message({
              message: '删除失败:' + response.data.message,
              type: 'error'
            })
          }
        })
          .catch(error => {
            this.btnLoading = false
            console.log(error)
            this.$message({
              message: '删除失败:' + error,
              type: 'error'
            })
          })
      })
    },
    removeBatch (id) {
      this.$confirm('确认删除该批次吗?', '提示', {
        type: 'warning'
      }).then(() => {
        let para = {ids: [id]}
        this.listLoading = true
        this.$http.post(this.$http.defaults.recruitAPI + 'api/recruitBusPostStepBatch/remove', para).then(response => {
          this.listLoading = false
          if (response.data.success === true) {
            this.$message({
              message: '删除成功',
              type: 'success'
            })
            this.getStepBatch()
            this.getPostListOtherStep()
          } else {
            console.log('删除失败:' + response.data.message)
            this.$message({
              message: '删除失败:' + response.data.message,
              type: 'error'
            })
          }
        })
          .catch(error => {
            this.listLoading = false
            console.log(error)
            this.$message({
              message: '删除失败:' + error,
              type: 'error'
            })
          })
      })
    },
    handleSelectionChange (val) {
      this.multipleSelection = val
    },
    getPostListOtherStep () {
      let para = {
        'step': this.step,
        'theYear': this.theYear,
        'unitId': this.unitId,
        deduct: 2
      }
      this.listLoading4 = true
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPost/queryList`, para).then(response => {
        this.listLoading4 = false
        if (response.data.success === true) {
          this.postList = response.data.result
        } else {
          console.log('获取失败:' + response.data.message)
          this.$message({
            message: '获取失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        this.listLoading4 = false
        console.log(error)
        this.$message({
          message: '获取失败:' + error,
          type: 'error'
        })
      })
    },
    getStepBatch () {
      let para = {
        'pageNum': 1,
        'pageSize': 10000,
        'step': this.step,
        'theYear': this.theYear,
        'unitId': this.unitId
      }
      if (this.userType !== 1) {
        para.isAdmin = true
      }
      this.listLoading = true
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPostStepBatch/queryByPage`, para).then(response => {
        this.listLoading = false
        if (response.data.success === true) {
          this.batchList = response.data.result.records
        } else {
          console.log('获取当前环节状态失败:' + response.data.message)
          this.$message({
            message: '获取当前环节状态失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        this.listLoading = false
        console.log(error)
        this.$message({
          message: '获取当前环节状态失败:' + error,
          type: 'error'
        })
      })
    },
    canSelect (row) {
      if (row.personState === 0 || row.personState === 5) {
        return true
      } else {
        return false
      }
    },
    canSelect2 (row) {
      if (row.personState === 1) {
        return true
      } else {
        return false
      }
    },
    canSelect3 (row) {
      if (row.personState === 2 && (row.settleDownState === 1 || row.settleDownState === 3)) {
        return true
      } else {
        return false
      }
    },
    canSelect4 (row) { // 拟聘人员备案可选择的为状态为stepState===1已确定人员的或2已签合同的
      if (row.stepState === 1 || row.stepState === 2) {
        return false
      } else {
        return true
      }
    },
    handleDetail (obj, theType, edit) {
      this.dialogTitle = edit ? '新增' : '详情'
      this.dialogEdit = edit
      if (theType === 1) {
        this.editForm.id = null
        this.editForm.state = 0
        this.editForm.postDockingId = obj.id
        this.editForm.unitName = obj.unitName
        this.editForm.theType = obj.theType
        this.editForm.department = obj.department
        this.editForm.post = obj.post
        this.editForm.unitBeijing = obj.unitBeijing
        this.editForm.theYear = obj.theYear
        this.editForm.realName = ''
        this.editForm.idCardNo = ''
        this.editForm.sex = ''
        this.editForm.nation = ''
        this.editForm.maritalStatus = ''
        this.editForm.phone = ''
        this.editForm.school = ''
        this.editForm.schoolLocation = ''
        this.editForm.place = ''
        this.editForm.reqMajor = obj.major
        this.editForm.major = ''
        this.editForm.majorClass1 = ''
        this.editForm.majorClass2 = ''
        this.editForm.internationalStudent = ''
        this.editForm.education = obj.education
        this.editForm.degree = ''
        this.editForm.recruitmentMethod = ''
        this.editForm.inputer = ''
        this.editForm.inputerPhone = ''
        this.editForm.inputDate = ''
        this.editForm.originalUnit = ''
        this.editForm.remarks = ''
        this.editForm.inBeijing = obj.inBeijing
        this.editForm.inPost = 1
        this.editForm.isSettleDown = 0
        this.editForm.nativePlace = obj.nativePlace
        this.addFormVisible = true
      } else {
        this.editFormb.id = null
        this.editFormb.state = 0
        this.editFormb.postDockingId = obj.id
        this.editFormb.unitName = obj.unitName
        this.editFormb.theType = obj.theType
        this.editFormb.department = obj.department
        this.editFormb.post = obj.post
        this.editFormb.unitBeijing = obj.unitBeijing
        this.editFormb.theYear = obj.theYear
        this.editFormb.realName = ''
        this.editFormb.idCardNo = ''
        this.editFormb.sex = ''
        this.editFormb.nation = ''
        this.editFormb.maritalStatus = ''
        this.editFormb.phone = ''
        this.editFormb.school = ''
        this.editFormb.schoolLocation = ''
        this.editFormb.place = ''
        this.editFormb.reqMajor = obj.major
        this.editFormb.major = ''
        this.editFormb.majorClass1 = ''
        this.editFormb.majorClass2 = ''
        this.editFormb.internationalStudent = ''
        this.editFormb.education = obj.education
        this.editFormb.degree = ''
        this.editFormb.recruitmentMethod = ''
        this.editFormb.inputer = ''
        this.editFormb.inputerPhone = ''
        this.editFormb.inputDate = ''
        this.editFormb.originalUnit = ''
        this.editFormb.remarks = ''
        this.editFormb.inBeijing = obj.inBeijing
        this.editFormb.inPost = 1
        this.editFormb.isSettleDown = 0
        this.addFormVisible_2 = true
      }
    },
    setForm (id) {
      console.log('setForm')
      console.log(id)
      let obj = this.personList.find(item => item.id === id)
      console.log(obj)
      if (obj.theType === 1) {
        this.editForm.id = obj.id
        this.editForm.state = obj.state
        this.editForm.unitName = obj.unitName
        this.editForm.theType = obj.theType
        this.editForm.department = obj.department
        this.editForm.post = obj.post
        this.editForm.realName = obj.realName
        this.editForm.idCardNo = obj.idCardNo
        this.editForm.sex = obj.sex
        this.editForm.nation = obj.nation
        this.editForm.maritalStatus = obj.maritalStatus
        this.editForm.phone = obj.phone
        this.editForm.school = obj.school
        this.editForm.schoolLocation = obj.schoolLocation
        this.editForm.place = obj.place
        this.editForm.major = obj.major
        this.editForm.majorClass1 = obj.majorClass1
        this.editForm.majorClass2 = obj.majorClass2
        this.editForm.internationalStudent = obj.internationalStudent
        this.editForm.education = obj.education
        this.editForm.degree = obj.degree
        this.editForm.recruitmentMethod = obj.recruitmentMethod
        this.editForm.inputer = obj.inputer
        this.editForm.inputerPhone = obj.inputerPhone
        this.editForm.inputDate = obj.inputDate
        this.editForm.originalUnit = obj.originalUnit
        this.editForm.unitBeijing = obj.unitBeijing
        this.editForm.remarks = obj.remarks
        this.editForm.theYear = obj.theYear
        this.editForm.inBeijing = obj.inBeijing
        this.editForm.inPost = obj.inPost
        this.editForm.isSettleDown = obj.isSettleDown
        this.editForm.meetMajorRequest = obj.meetMajorRequest
        this.editForm.nativePlace = obj.nativePlace
      } else {
        this.editFormb.id = obj.id
        this.editFormb.state = obj.state
        this.editFormb.unitName = obj.unitName
        this.editFormb.theType = obj.theType
        this.editFormb.department = obj.department
        this.editFormb.post = obj.post
        this.editFormb.realName = obj.realName
        this.editFormb.idCardNo = obj.idCardNo
        this.editFormb.sex = obj.sex
        this.editFormb.nation = obj.nation
        this.editFormb.maritalStatus = obj.maritalStatus
        this.editFormb.phone = obj.phone
        this.editFormb.school = obj.school
        this.editFormb.schoolLocation = obj.schoolLocation
        this.editFormb.place = obj.place
        this.editFormb.major = obj.major
        this.editFormb.majorClass1 = obj.majorClass1
        this.editFormb.majorClass2 = obj.majorClass2
        this.editFormb.internationalStudent = obj.internationalStudent
        this.editFormb.education = obj.education
        this.editFormb.degree = obj.degree
        this.editFormb.recruitmentMethod = obj.recruitmentMethod
        this.editFormb.inputer = obj.inputer
        this.editFormb.inputerPhone = obj.inputerPhone
        this.editFormb.inputDate = obj.inputDate
        this.editFormb.originalUnit = obj.originalUnit
        this.editFormb.unitBeijing = obj.unitBeijing
        this.editFormb.remarks = obj.remarks
        this.editFormb.theYear = obj.theYear
        this.editFormb.inBeijing = obj.inBeijing
        this.editFormb.inPost = obj.inPost
        this.editFormb.isSettleDown = obj.isSettleDown
        this.editFormb.meetMajorRequest = obj.meetMajorRequest
      }
    },
    handleDetailList (obj) {
      this.dialogTitle = '详情'
      this.dialogEdit = 0
      let para = {postId: obj.id}
      this.personLoading = true
      this.$http.post(this.$http.defaults.recruitAPI + 'api/recruitBusCandidateRegistration/queryList', para).then(response => {
        this.personLoading = false
        if (response.data.success === true) {
          if (obj.theType === 1) {
            this.editForm.reqMajor = obj.major
            // this.editForm.nativePlace = obj.nativePlace
          } else {
            this.editFormb.reqMajor = obj.major
          }
          this.personList = response.data.result
          this.personId = response.data.result[0].id
          this.setForm(this.personId)
          if (response.data.result[0].theType === 1) {
            this.addFormVisible = true
          } else {
            this.addFormVisible_2 = true
          }
        } else {
          console.log('获取数据失败:' + response.data.message)
          this.$message({
            message: '获取数据失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        console.log(error)
        this.$message({
          message: '网络获取失败:' + error,
          type: 'error'
        })
        this.personLoading = false
      })
    },
    handleDetail2 (obj) {
      this.detailLoading = true
      let para = {
        pageNum: 1,
        pageSize: 1,
        candidateRegistrationId: obj.personId
      }
      this.$http.post(this.$http.defaults.recruitAPI + 'api/recruitBusSettlementRegistration/queryByPage', para).then(response => {
        if (response.data.success === true) {
          if (response.data.result.records && response.data.result.records.length > 0) {
            this.detailLoading = false
            this.editForm2 = response.data.result.records[0]
          } else {
            this.editForm2.id = null
            this.editForm2.postId = obj.id
            this.editForm2.candidateRegistrationId = obj.personId
            this.editForm2.realName = obj.realName
            this.editForm2.idCardNo = obj.idCardNo
            this.editForm2.unitName = obj.unitName
            this.editForm2.state = 1
            this.editForm2.sex = obj.sex
            this.editForm2.nation = obj.nation
            this.editForm2.maritalStatus = ''
            this.editForm2.education = obj.education
            this.editForm2.place = obj.place
            this.editForm2.school = obj.school
            this.editForm2.graduationCertificateNumber = ''
            this.editForm2.schoolLocation = obj.schoolLocation
            this.editForm2.degreeCertificateNumber = ''
            this.editForm2.relocationAddress = ''
            this.editForm2.relocationOrgan = ''
            this.editForm2.movingInAddress = ''
            this.editForm2.movingInOrgan = ''
            this.editForm2.settlementArea = ''
            this.editForm2.phone = obj.phone
            this.editForm2.inputer = ''
            this.editForm2.inputerPhone = ''
            this.editForm2.inputerCellPhone = ''
            this.editForm2.inputDate = ''
            this.editForm2.nativePlace = obj.nativePlace
            this.$http.get(this.$http.defaults.recruitAPI + 'api/recruitBusCandidateRegistration/getById?id=' + obj.personId, para).then(response => {
              this.editForm2.sex = response.data.result.sex
              this.editForm2.nation = response.data.result.nation
              this.editForm2.education = response.data.result.education
              this.editForm2.school = response.data.result.school
              this.editForm2.schoolLocation = response.data.result.schoolLocation
              this.editForm2.phone = response.data.result.phone
              this.editForm2.maritalStatus = response.data.result.maritalStatus
              this.editForm2.place = response.data.result.place
            })
          }
          this.dialogTitle = this.editForm2.state === 2 ? '详情' : '备案'
          this.addFormVisible2 = true
        } else {
          this.detailLoading = false
          console.log('获取数据失败:' + response.data.message)
          this.$message({
            message: '获取数据失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        console.log(error)
        this.$message({
          message: '网络获取失败:' + error,
          type: 'error'
        })
        this.detailLoading = false
      })
    },
    editFormSubmit2 () {
      this.$refs.editForm2.validate((valid) => {
        if (valid) {
          this.editLoading = true
          let para = {
            id: this.editForm2.id,
            unitName: this.editForm2.unitName,
            realName: this.editForm2.realName,
            sex: this.editForm2.sex,
            nation: this.editForm2.nation,
            maritalStatus: this.editForm2.maritalStatus,
            idCardNo: this.editForm2.idCardNo,
            education: this.editForm2.education,
            place: this.editForm2.place,
            school: this.editForm2.school,
            graduationCertificateNumber: this.editForm2.graduationCertificateNumber,
            schoolLocation: this.editForm2.schoolLocation,
            degreeCertificateNumber: this.editForm2.degreeCertificateNumber,
            relocationAddress: this.editForm2.relocationAddress,
            relocationOrgan: this.editForm2.relocationOrgan,
            movingInAddress: this.editForm2.movingInAddress,
            movingInOrgan: this.editForm2.movingInOrgan,
            settlementArea: this.editForm2.settlementArea,
            phone: this.editForm2.phone,
            inputer: this.editForm2.inputer,
            inputerPhone: this.editForm2.inputerPhone,
            inputerCellPhone: this.editForm2.inputerCellPhone,
            inputDate: this.editForm2.inputDate,
            theYear: this.theYear,
            postId: this.editForm2.postId,
            candidateRegistrationId: this.editForm2.candidateRegistrationId,
            state: this.editForm2.state,
            nativePlace: this.editForm2.nativePlace
          }
          if (this.isShow) {
            this.$confirm('生源地和生源类型不一致，是否确认保存？', '提示', {
              type: 'warning'
            }).then(() => {
              this.editFormPost2(para)
            }).catch(() => {
              this.editLoading = false
            })
          } else {
            this.editFormPost2(para)
          }
        }
      })
    },
    editFormPost2 (para) {
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusSettlementRegistration/save`, para).then(response => {
        console.log(response.data.success)
        if (response.data.success === true) {
          this.$message({
            message: '保存成功',
            type: 'success'
          })
          this.addFormVisible2 = false
          this.editLoading = false
          this.getPostListOtherStep()
        } else {
          console.log('保存失败:' + response.data.message)
          this.$message({
            message: '保存失败:' + response.data.message,
            type: 'error'
          })
          this.editLoading = false
        }
      }).catch(error => {
        console.log(error)
        this.$message({
          message: '保存失败:' + error,
          type: 'error'
        })
        this.editLoading = false
      })
    },
    export1 (theType) {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.recruitAPI + 'api/recruitBusCandidateRegistration/export?unitBatchId=' + this.unitBatchId + '&type=' + theType)
    },
    export2 () {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.recruitAPI + 'api/recruitBusSettlementRegistration/export?unitBatchId=' + this.unitBatchId)
    },
    // del (id) {
    //   // 未作table2处理
    //   let tableName = 'recruitBusCandidateRegistration'
    //   if (this.step === 'bus_settlement_registration') {
    //     tableName = 'recruitBusSettlementRegistration'
    //   }
    //   this.$confirm('确认删除该记录吗?', '提示', {
    //     type: 'warning'
    //   }).then(() => {
    //     let para = {ids: [id]}
    //     this.listLoading = true
    //     this.$http.post(this.$http.defaults.recruitAPI + 'api/' + tableName + '/remove', para).then(response => {
    //       if (response.data.success === true) {
    //         this.addLoading = false
    //         this.$message({
    //           message: '删除成功',
    //           type: 'success'
    //         })
    //       } else {
    //         console.log('删除失败:' + response.data.message)
    //         this.$message({
    //           message: '删除失败:' + response.data.message,
    //           type: 'error'
    //         })
    //       }
    //       this.getList()
    //     })
    //       .catch(error => {
    //         console.log(error)
    //         this.$message({
    //           message: '删除失败:' + error,
    //           type: 'error'
    //         })
    //       })
    //   })
    // },
    // getList () {
    //   // 未作table2处理
    //   let tableName = 'recruitBusSettlementRegistration'
    //   this.listLoading = true
    //   let para = {
    //     pageNum: 1,
    //     pageSize: 1000,
    //     unitBatchId: this.unitBatchId
    //   }
    //   if (this.step === 'bus_candidate_registration') {
    //     tableName = 'recruitBusCandidateRegistration'
    //     para.theType = 1
    //   }
    //   this.$http.post(this.$http.defaults.recruitAPI + 'api/' + tableName + '/queryByPage', para).then(response => {
    //     this.listLoading = false
    //     if (response.data.success === true) {
    //       this.list = response.data.result.records
    //     } else {
    //       console.log('获取数据失败:' + response.data.message)
    //       this.$message({
    //         message: '获取数据失败:' + response.data.message,
    //         type: 'error'
    //       })
    //     }
    //   }).catch(error => {
    //     console.log(error)
    //     this.$message({
    //       message: '网络获取失败:' + error,
    //       type: 'error'
    //     })
    //     this.listLoading = false
    //   })
    //   if (this.step === 'bus_candidate_registration') {
    //     let para2 = {
    //       pageNum: 1,
    //       pageSize: 1000,
    //       unitBatchId: this.unitBatchId,
    //       theType: 2
    //     }
    //     this.$http.post(this.$http.defaults.recruitAPI + 'api/' + tableName + '/queryByPage', para2).then(response => {
    //       this.listLoading = false
    //       if (response.data.success === true) {
    //         this.list_2 = response.data.result.records
    //       } else {
    //         console.log('获取数据失败:' + response.data.message)
    //         this.$message({
    //           message: '获取数据失败:' + response.data.message,
    //           type: 'error'
    //         })
    //       }
    //     }).catch(error => {
    //       console.log(error)
    //       this.$message({
    //         message: '网络获取失败:' + error,
    //         type: 'error'
    //       })
    //       this.listLoading = false
    //     })
    //   }
    // },
    editFormSubmit (flag) {
      this.$refs.editForm.validate((valid) => {
        if (valid) {
          this.editForm.major = this.editForm.major.toString().replace(/（/g, '(').replace(/）/g, ')')
          this.editForm.majorClass1 = this.editForm.majorClass1.toString().replace(/（/g, '(').replace(/）/g, ')')
          this.editForm.majorClass2 = this.editForm.majorClass2.toString().replace(/（/g, '(').replace(/）/g, ')')
          this.editLoading = true
          let para = {
            id: this.editForm.id,
            unitName: this.editForm.unitName,
            theType: this.editForm.theType,
            department: this.editForm.department,
            post: this.editForm.post,
            realName: this.editForm.realName,
            idCardNo: this.editForm.idCardNo,
            sex: this.editForm.sex,
            nation: this.editForm.nation,
            maritalStatus: this.editForm.maritalStatus,
            phone: this.editForm.phone,
            school: this.editForm.school,
            schoolLocation: this.editForm.schoolLocation,
            place: this.editForm.place,
            major: this.editForm.major,
            majorClass1: this.editForm.majorClass1,
            majorClass2: this.editForm.majorClass2,
            internationalStudent: this.editForm.internationalStudent,
            education: this.editForm.education,
            degree: this.editForm.degree,
            recruitmentMethod: this.editForm.recruitmentMethod,
            inputer: this.editForm.inputer,
            inputerPhone: this.editForm.inputerPhone,
            inputDate: this.editForm.inputDate,
            originalUnit: this.editForm.originalUnit,
            postDockingId: this.editForm.id ? null : this.editForm.postDockingId,
            unitBeijing: this.editForm.unitBeijing,
            remarks: this.editForm.remarks,
            theYear: this.editForm.theYear,
            inBeijing: this.editForm.inBeijing,
            inPost: this.editForm.inPost !== null ? this.editForm.inPost : 1,
            isSettleDown: (this.editForm.unitBeijing === 1 && this.editForm.inBeijing === 2) ? 0 : 1,
            state: this.editForm.state ? this.editForm.state : 0,
            noTestMajorFlag: flag,
            nativePlace: this.editForm.nativePlace
          }
          if (flag) {
            this.editFormPost(para)
          } else if (this.isShow) {
            this.$confirm('生源地和生源类型不一致，是否确认保存？', '提示', {
              type: 'warning'
            }).then(() => {
              this.editFormPost(para)
            }).catch(() => {
              this.editLoading = false
            })
          } else {
            this.editFormPost(para)
          }
        }
      })
    },
    editFormPost (para) {
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusCandidateRegistration/save`, para).then(response => {
        console.log(response.data.success)
        if (response.data.success === true) {
          this.$message({
            message: '保存成功',
            type: 'success'
          })
          this.addFormVisible = false
          this.editLoading = false
          this.getPostListOtherStep()
        } else {
          if (response.data.message === '发生错误：专业与岗位要求不符') {
            this.$confirm('专业与岗位要求不完全一致，确定要保存吗？', '提示', {
              type: 'warning'
            }).then(() => {
              this.editFormSubmit(true)
            }).catch(() => {
              this.editLoading = false
            })
          } else {
            console.log('保存失败:' + response.data.message)
            this.$message({
              message: '保存失败:' + response.data.message,
              type: 'error'
            })
            this.editLoading = false
          }
        }
      }).catch(error => {
        console.log(error)
        this.$message({
          message: '保存失败:' + error,
          type: 'error'
        })
        this.editLoading = false
      })
    },
    editFormSubmitB (flag) {
      this.$refs.editFormb.validate((valid) => {
        if (valid) {
          this.editFormb.major = this.editFormb.major.toString().replace(/（/g, '(').replace(/）/g, ')')
          this.editLoading = true
          let para = {
            id: this.editFormb.id,
            unitName: this.editFormb.unitName,
            theType: this.editFormb.theType,
            department: this.editFormb.department,
            post: this.editFormb.post,
            realName: this.editFormb.realName,
            idCardNo: this.editFormb.idCardNo,
            sex: this.editFormb.sex,
            nation: this.editFormb.nation,
            maritalStatus: this.editFormb.maritalStatus,
            phone: this.editFormb.phone,
            school: this.editFormb.school,
            schoolLocation: this.editFormb.schoolLocation,
            place: this.editFormb.place,
            major: this.editFormb.major,
            majorClass1: this.editFormb.majorClass1,
            majorClass2: this.editFormb.majorClass2,
            internationalStudent: this.editFormb.internationalStudent,
            education: this.editFormb.education,
            degree: this.editFormb.degree,
            recruitmentMethod: this.editFormb.recruitmentMethod,
            inputer: this.editFormb.inputer,
            inputerPhone: this.editFormb.inputerPhone,
            inputDate: this.editFormb.inputDate,
            originalUnit: this.editFormb.originalUnit,
            postDockingId: this.editFormb.id ? null : this.editFormb.postDockingId,
            unitBeijing: this.editFormb.unitBeijing,
            remarks: this.editFormb.remarks,
            theYear: this.editFormb.theYear,
            inPost: this.editFormb.inPost !== null ? this.editFormb.inPost : 1,
            isSettleDown: 1,
            state: this.editFormb.state ? this.editFormb.state : 0,
            noTestMajorFlag: flag
          }
          this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusCandidateRegistration/save`, para).then(response => {
            console.log(response.data.success)
            if (response.data.success === true) {
              this.$message({
                message: '保存成功',
                type: 'success'
              })
              this.addFormVisible_2 = false
              this.editLoading = false
              this.getPostListOtherStep()
            } else {
              if (response.data.message === '发生错误：专业与岗位要求不符') {
                this.$confirm('专业与岗位要求不完全一致，确定要保存吗？', '提示', {
                  type: 'warning'
                }).then(() => {
                  this.editFormSubmitB(true)
                }).catch(() => {
                  this.editLoading = false
                })
              } else {
                console.log('保存失败:' + response.data.message)
                this.$message({
                  message: '保存失败:' + response.data.message,
                  type: 'error'
                })
                this.editLoading = false
              }
            }
          }).catch(error => {
            console.log(error)
            this.$message({
              message: '保存失败:' + error,
              type: 'error'
            })
            this.editLoading = false
          })
        }
      })
    },
    showBack (id) {
      this.stepBatchId = id
      this.backFormVisible = true
      this.backForm.remark = ''
    },
    beforeUpload (file) {
      if (this.step === 'bus_interviewer_filing' || this.step === 'bus_interviewer_results') {
        const isFormat = file.name.indexOf('.pdf') > 0 || file.name.indexOf('.PDF') > 0
        const isLt500M = file.size / 1024 / 1024 < 60
        if (!isLt500M) {
          this.$message.error('单个附件不能超过60M!')
        } else {
          if (!isFormat) {
            this.$message.error('附件格式必须为pdf!')
          } else {
            this.saveloading = true
          }
        }
        return isFormat && isLt500M
      } else {
        const isFormat = file.name.indexOf('.docx') > 0 || file.name.indexOf('.doc') > 0 || file.name.indexOf('.pdf') > 0 || file.name.indexOf('.DOCX') > 0 || file.name.indexOf('.DOC') > 0 || file.name.indexOf('.PDF') > 0 || file.name.indexOf('.wps') > 0 || file.name.indexOf('.WPS') > 0
        const isLt500M = file.size / 1024 / 1024 < 60
        if (!isLt500M) {
          this.$message.error('单个附件不能超过60M!')
        } else {
          if (!isFormat) {
            this.$message.error('附件格式必须为word、pdf、wps!')
          } else {
            this.saveloading = true
          }
        }
        return isFormat && isLt500M
      }
    },
    async handleUploadSucc1 (response, file, stepBatchId) {
      this.uploadSuccCommon(response, file, stepBatchId, this.step, 'files')
    },
    uploadSuccCommon (response, file, stepBatchId) {
      if (response.success) {
        let para = {
          id: response.result[0].id,
          businessTable: 'bus_post_step_batch',
          businessId: stepBatchId,
          theYear: this.theYear
        }
        this.$http.post(this.$http.defaults.recruitAPI + `api/recruitGenFileInfo/save`, para).then(res => {
          this.saveloading = false
          if (res.data.success === true) {
            this.$message({
              message: '上传成功！',
              type: 'success'
            })
            // this.getFileList()
            this.getStepBatch()
          } else {
            console.log('上传失败:' + res.data.message)
            this.$message({
              message: '上传失败:' + res.data.message,
              type: 'error'
            })
          }
        })
          .catch(error => {
            this.saveloading = false
            console.log(error)
            this.$message({
              message: '上传失败:' + error,
              type: 'error'
            })
          })
      } else {
        this.saveloading = false
        this.$message({
          message: '上传失败:' + response.message,
          type: 'error'
        })
      }
    },
    beforeRemove (file) {
      this.$confirm('确定删除' + file.fileName + '.' + file.fileType + '？', '提示', {
        type: 'warning'
      }).then(() => {
        this.handleRemove(file.id)
      })
    },
    handleRemove (id) {
      const url = 'api/recruitGenFileInfo/remove?id=' + id
      this.listLoading = true
      this.$http.get(this.$http.defaults.recruitAPI + url).then(res => {
        console.log('删除成功:', res)
        this.listLoading = false
        if (res.data.success === true) {
          // this.getFileList()
          this.getStepBatch()
          this.$message({
            message: '删除成功！',
            type: 'success'
          })
        }
      })
    },
    uploadError (err) {
      this.saveloading = false
      console.log(err)
      this.$message({
        message: '上传失败:' + err,
        type: 'error'
      })
    },
    download (id) {
      window.open(this.$http.defaults.baseURL + this.$http.defaults.recruitAPI + 'api/recruitGenFileInfo/download?id=' + id)
    },
    getFileList () {
      this.fileListLoading = true
      let para = {
        unitId: this.unitId,
        businessStep: this.step,
        theYear: this.theYear
      }
      let objName = 'files'
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitGenFileInfo/getFiles`, para).then(response => {
        this.fileListLoading = false
        if (response.data.success === true) {
          this[objName] = response.data.result
        } else {
          console.log('获取失败:' + response.data.message)
          this.$message({
            message: '获取失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        console.log(error)
        this.$message({
          message: '网络获取失败:' + error,
          type: 'error'
        })
        this.fileListLoading = false
      })
    },
    getNum (i) {
      return i < 10 ? '0' + i : i
    },
    setState (state, stepBatchId) {
      let stateText = ''
      switch (state) {
        case 0:
          stateText = '打捆'
          break
        case 1:
          stateText = '提交'
          break
        case 5:
          stateText = '退回'
          break
      }
      this.$confirm('确认' + stateText + '吗?', '提示', {
        type: 'warning'
      }).then(() => {
        let para = {
          state: state,
          theYear: this.theYear,
          step: this.step
        }
        if (state === 5) {
          para.id = this.stepBatchId
          para.remarks = this.backForm.remark
        }
        if (state === 1) {
          if (this.step === 'bus_sign_contract') {
            if (stepBatchId.stepState === 0) {
              para.candidateRegistrationIds = ',' + stepBatchId.personId + ','
              para.postDockingIds = ',' + stepBatchId.id + ','
            } else {
              para.id = stepBatchId.batchId
            }
          } else if (this.step === 'bus_registration') {
            if (stepBatchId.stepState === 0) {
              para.postDockingIds = ',' + stepBatchId.id + ','
            } else {
              para.id = stepBatchId.batchId
            }
          } else {
            para.id = stepBatchId
          }
        }
        if (state === 0 && this.step !== 'bus_post_docking' && this.step !== 'bus_plan_release' && this.step !== 'bus_plan_declare') {
          if (this.multipleSelection && this.multipleSelection.length > 0) {
            para.postDockingIds = ',' + this.multipleSelection.map(item => item.id).join(',') + ','
            para.fileIds = this.files.map(item => item.id)
            if (this.step === 'bus_candidate_registration' || this.step === 'bus_sign_contract' || this.step === 'bus_settlement_registration') {
              para.candidateRegistrationIds = ',' + this.multipleSelection.map(item => item.personId).join(',') + ','
            }
          } else {
            this.$message({
              message: '请至少选择一个岗位',
              type: 'error'
            })
            return false
          }
        }
        if (this.step === 'bus_post_docking' && state === 1) {
          if (this.list1.filter(item => !item.deduct).length > 0 || this.list2.filter(item => !item.deduct).length > 0 || this.list3.filter(item => !item.deduct).length > 0) {
            this.$message({
              message: '操作失败:请将全部岗位设为核减或保留后再提交',
              type: 'error'
            })
          } else {
            this.$http.get(this.$http.defaults.recruitAPI + `api/recruitBusPost/getDeductEquals?theYear=` + this.theYear).then(response => {
              if (response.data.success === true) {
                if (response.data.result) {
                  this.updatePostStepBatch(para)
                } else {
                  this.$message({
                    message: '操作失败:保留岗位数必须等于或小于计划下达数',
                    type: 'error'
                  })
                }
              } else {
                console.log('操作失败:' + response.data.message)
                this.$message({
                  message: '操作失败:' + response.data.message,
                  type: 'error'
                })
              }
            }).catch(error => {
              console.log(error)
              this.$message({
                message: '操作失败:' + error,
                type: 'error'
              })
            })
          }
        } else {
          this.updatePostStepBatch(para)
        }
      })
    },
    updatePostStepBatch (para) {
      this.btnLoading = true
      this.$http.post(this.$http.defaults.recruitAPI + `api/recruitBusPostStepBatch/save`, para).then(response => {
        this.btnLoading = false
        if (response.data.success === true) {
          this.$message({
            message: '操作成功',
            type: 'success'
          })
          this.backFormVisible = false
          this.$emit('getDetails')
        } else {
          console.log('操作失败:' + response.data.message)
          this.$message({
            message: '操作失败:' + response.data.message,
            type: 'error'
          })
        }
      }).catch(error => {
        this.btnLoading = false
        console.log(error)
        this.$message({
          message: '操作失败:' + error,
          type: 'error'
        })
      })
    },
    getFilesList () {
      this.fileListLoading = true
      this.$http.get(this.$http.defaults.recruitAPI + `api/recruitBusAnnual/getFileList2ByYear?theYear=${this.theYear}`)
        .then(response => {
          this.fileListLoading = false
          if (response.data.success === true) {
            this.files1 = response.data.result
          } else {
            console.log('获取失败:' + response.data.message)
            this.$message({
              message: '获取失败:' + response.data.message,
              type: 'error'
            })
          }
        }).catch(error => {
          console.log(error)
          this.$message({
            message: '网络获取失败:' + error,
            type: 'error'
          })
          this.fileListLoading = false
        })
    }
  }
}
</script>
<style scoped>
  .mytable{
    border-top: 1px solid #74a6cc;
    border-left: 1px solid #74a6cc;
    margin:0 10px 10px;
    width: calc(100% - 20px);
  }
  .mytable th{
    padding: 10px;
    border-right: 1px solid #74a6cc;
    border-bottom: 1px solid #74a6cc;
    vertical-align: top;
    line-height: 150%;
    background: #FAFAFA;
    width:200px;
    text-align:right;
  }
  .mytable td{
    padding: 10px;
    border-right: 1px solid #74a6cc;
    border-bottom: 1px solid #74a6cc;
    vertical-align: top;
    line-height: 150%;
  }
</style>
<style>
#recruitTable .el-table{
  border:1px solid #95B8E7 !important;
}
#recruitTable .el-table td, #recruitTable .el-table th{
  border-right:1px solid #95B8E7 !important;
  border-bottom:1px solid #95B8E7 !important;
}
</style>
